From 944e90334afc836ac4d87fb988372c39d28cf3fe Mon Sep 17 00:00:00 2001 From: Pierre Maurice Schwang Date: Sun, 15 Oct 2023 22:47:24 +0200 Subject: [PATCH] chore/fix: cache fawe artifact and fix java 21 --- build.gradle.kts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a4e53c6c7..33d551813 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -226,20 +226,25 @@ tasks.getByName("jar") { val supportedVersions = listOf("1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20.1", "1.20.2") tasks { - val lastSuccessfulBuildUrl = uri("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/api/json").toURL() - val artifact = ((JsonSlurper().parse(lastSuccessfulBuildUrl) as Map<*, *>)["artifacts"] as List<*>) - .map { it as Map<*, *> } - .map { it["fileName"] as String } - .first { it.contains("Bukkit") } + register("cacheLatestFaweArtifact") { + val lastSuccessfulBuildUrl = uri("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/api/json").toURL() + val artifact = ((JsonSlurper().parse(lastSuccessfulBuildUrl) as Map<*, *>)["artifacts"] as List<*>) + .map { it as Map<*, *> } + .map { it["fileName"] as String } + .first { it -> it.contains("Bukkit") } + project.ext["faweArtifact"] = artifact + } supportedVersions.forEach { register("runServer-$it") { + dependsOn(getByName("cacheLatestFaweArtifact")) 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()) jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true") 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" runDirectory.set(file("run-$it"))