-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
367 additions
and
96 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...in/kotlin/cn/taskeren/version/cli/Main.kt → ...in/kotlin/cn/taskeren/version/cli/Main.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../taskeren/version/ForgedVersionChannel.kt → ...ren/version/forge/ForgedVersionChannel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/cn/taskeren/version/forge/VersionCheckResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cn.taskeren.version.forge | ||
|
||
import org.apache.maven.artifact.versioning.ComparableVersion | ||
|
||
data class VersionCheckResult( | ||
val status: VersionStatus, | ||
val current: ComparableVersion?, | ||
val target: ComparableVersion?, | ||
val changes: LinkedHashMap<ComparableVersion, String>, | ||
val homepage: String? | ||
) { | ||
fun printForgeLog() = println("Found status: $status Current: $current Target: $target") | ||
} |
2 changes: 1 addition & 1 deletion
2
...tlin/cn/taskeren/version/VersionStatus.kt → ...n/taskeren/version/forge/VersionStatus.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package cn.taskeren.version | ||
package cn.taskeren.version.forge | ||
|
||
enum class VersionStatus { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package cn.taskeren.version.taco | ||
|
||
object TacoConst { | ||
|
||
var tacoNameValidator: String.() -> Boolean = { !contains('-') } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package cn.taskeren.version.taco | ||
|
||
import org.apache.maven.artifact.versioning.ComparableVersion | ||
|
||
/** | ||
* Taco Version V1 | ||
*/ | ||
data class TacoVersion( | ||
val name: String, | ||
val versions: LinkedHashSet<TacoVersionEntry> = linkedSetOf(), | ||
val subVersions: LinkedHashMap<String, TacoVersion> = linkedMapOf() | ||
): Iterable<TacoVersion.TacoVersionEntry> { | ||
|
||
var parent: TacoVersion? = null | ||
|
||
val fullName: String get() = if(parent != null) "${parent!!.fullName}/${name}" else name | ||
|
||
data class TacoVersionEntry(val version: ComparableVersion, val properties: Map<String, Any> = mapOf()) { | ||
override fun hashCode(): Int { | ||
return version.hashCode() | ||
} | ||
|
||
override fun equals(other: Any?): Boolean { | ||
return other is TacoVersionEntry && version == other.version && properties == other.properties | ||
} | ||
} | ||
|
||
fun addVersion(version: ComparableVersion, properties: Map<String, Any>) { | ||
versions += TacoVersionEntry(version, properties) | ||
} | ||
|
||
fun removeVersion(version: ComparableVersion): Boolean { | ||
return versions.removeAll { it.version == version } | ||
} | ||
|
||
fun getOrCreateSub(subName: String): TacoVersion { | ||
return subVersions.computeIfAbsent(subName) { createSub(subName) } | ||
} | ||
|
||
internal fun createSub(subName: String) = TacoVersion(subName).apply { this.parent = this@TacoVersion; this@TacoVersion.subVersions[subName] = this } | ||
|
||
override fun iterator(): Iterator<TacoVersionEntry> = versions.iterator() | ||
} |
Oops, something went wrong.