Fix doRelease gradle task
This commit is contained in:
@@ -69,7 +69,7 @@ fun command(vararg cmd: Any): List<String> {
|
|||||||
commandLine(*cmd)
|
commandLine(*cmd)
|
||||||
standardOutput = stdout
|
standardOutput = stdout
|
||||||
}
|
}
|
||||||
return stdout.toString().split("\n")
|
return stdout.toString().trim().split("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun generateVersionsJson(): Map<String, Any> {
|
fun generateVersionsJson(): Map<String, Any> {
|
||||||
@@ -86,6 +86,10 @@ fun generateVersionsJson(): Map<String, Any> {
|
|||||||
val commitVersions = releaseCommits.map { commit ->
|
val commitVersions = releaseCommits.map { commit ->
|
||||||
val version = command("git", "show", "$commit:version.txt").first()
|
val version = command("git", "show", "$commit:version.txt").first()
|
||||||
val mcVersions = command("git", "ls-tree", "-d", "--name-only", "$commit:versions")
|
val mcVersions = command("git", "ls-tree", "-d", "--name-only", "$commit:versions")
|
||||||
|
// In the past (early days of preprocessor) we used to have an internal "core" project
|
||||||
|
.filter { it != "core" }
|
||||||
|
// Internal project used to automatically remap from Forge 1.12.2 to Fabric 1.14.4
|
||||||
|
.filter { it != "1.14.4-forge" }
|
||||||
mcVersions.map { "$it-$version" }
|
mcVersions.map { "$it-$version" }
|
||||||
}.flatten()
|
}.flatten()
|
||||||
|
|
||||||
@@ -94,9 +98,9 @@ fun generateVersionsJson(): Map<String, Any> {
|
|||||||
.map {it.substring(0, it.indexOf("-"))}
|
.map {it.substring(0, it.indexOf("-"))}
|
||||||
.distinct()
|
.distinct()
|
||||||
.sortedWith(compareBy(
|
.sortedWith(compareBy(
|
||||||
{ (it.split(".")[0] ?: "0").toInt() },
|
{ (it.split(".").getOrNull(0) ?: "0").toInt() },
|
||||||
{ (it.split(".")[1] ?: "0").toInt() },
|
{ (it.split(".").getOrNull(1) ?: "0").toInt() },
|
||||||
{ (it.split(".")[2] ?: "0").toInt() }
|
{ (it.split(".").getOrNull(2) ?: "0").toInt() }
|
||||||
))
|
))
|
||||||
|
|
||||||
val promos = mutableMapOf<String, String>()
|
val promos = mutableMapOf<String, String>()
|
||||||
@@ -109,7 +113,7 @@ fun generateVersionsJson(): Map<String, Any> {
|
|||||||
var latest: String? = null
|
var latest: String? = null
|
||||||
var recommended: String? = null
|
var recommended: String? = null
|
||||||
versions.forEach {
|
versions.forEach {
|
||||||
val (thisMcVersion, modVersion, preVersion) = it.split("-")
|
val (thisMcVersion, modVersion, preVersion) = it.split("-") + listOf(null, null)
|
||||||
if (thisMcVersion == mcVersion) {
|
if (thisMcVersion == mcVersion) {
|
||||||
mcVersionRoot[it] = if (tagVersions.contains(it))
|
mcVersionRoot[it] = if (tagVersions.contains(it))
|
||||||
"See https://github.com/ReplayMod/ReplayMod/releases/$it"
|
"See https://github.com/ReplayMod/ReplayMod/releases/$it"
|
||||||
@@ -133,7 +137,7 @@ fun generateVersionsJson(): Map<String, Any> {
|
|||||||
val doRelease by tasks.registering {
|
val doRelease by tasks.registering {
|
||||||
doLast {
|
doLast {
|
||||||
// Parse version
|
// Parse version
|
||||||
val version = project.extra("releaseVersion") as String
|
val version = project.extra["releaseVersion"] as String
|
||||||
if (gitDescribe().endsWith("*")) {
|
if (gitDescribe().endsWith("*")) {
|
||||||
throw InvalidUserDataException("Git working tree is dirty. Make sure to commit all changes.")
|
throw InvalidUserDataException("Git working tree is dirty. Make sure to commit all changes.")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user