chore/fix(:runServer): cache fawe artifact and fix java 21 (#4209)

chore/fix: cache fawe artifact and fix java 21
This commit is contained in:
Pierre Maurice Schwang 2023-10-16 19:23:25 +02:00 committed by GitHub
parent c013b92e62
commit 16a4ee835c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,20 +226,25 @@ tasks.getByName<Jar>("jar") {
val supportedVersions = listOf("1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20.1", "1.20.2") val supportedVersions = listOf("1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20.1", "1.20.2")
tasks { tasks {
register("cacheLatestFaweArtifact") {
val lastSuccessfulBuildUrl = uri("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/api/json").toURL() val lastSuccessfulBuildUrl = uri("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/api/json").toURL()
val artifact = ((JsonSlurper().parse(lastSuccessfulBuildUrl) as Map<*, *>)["artifacts"] as List<*>) val artifact = ((JsonSlurper().parse(lastSuccessfulBuildUrl) as Map<*, *>)["artifacts"] as List<*>)
.map { it as Map<*, *> } .map { it as Map<*, *> }
.map { it["fileName"] as String } .map { it["fileName"] as String }
.first { it.contains("Bukkit") } .first { it -> it.contains("Bukkit") }
project.ext["faweArtifact"] = artifact
}
supportedVersions.forEach { supportedVersions.forEach {
register<RunServer>("runServer-$it") { register<RunServer>("runServer-$it") {
dependsOn(getByName("cacheLatestFaweArtifact"))
minecraftVersion(it) minecraftVersion(it)
pluginJars(*project(":plotsquared-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile } pluginJars(*project(":plotsquared-bukkit").getTasksByName("shadowJar", false)
.map { task -> (task as Jar).archiveFile }
.toTypedArray()) .toTypedArray())
jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true") jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true")
downloadPlugins { downloadPlugins {
url("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/artifact/artifacts/$artifact") url("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/artifact/artifacts/${project.ext["faweArtifact"]}")
} }
group = "run paper" group = "run paper"
runDirectory.set(file("run-$it")) runDirectory.set(file("run-$it"))