diff --git a/build.gradle.kts b/build.gradle.kts index 4cab9548b..df1d9e0b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ import org.ajoberstar.grgit.Grgit import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED +import org.gradle.configurationcache.extensions.capitalized import xyz.jpenilla.runpaper.task.RunServer import java.net.URI import java.time.format.DateTimeFormatter @@ -87,30 +88,27 @@ val supportedVersions = listOf("1.18.2", "1.19.4", "1.20", "1.20.4") val foliaSupportedVersions = listOf("1.20.1") tasks { - supportedVersions.forEach { - register("runServer-$it") { - minecraftVersion(it) - pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile } + fun registerVersion(version: String, software: String, task: RunServer.() -> Unit = {}) { + register("run${software.capitalized()}-$version") { + minecraftVersion(version) + pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false) + .map { (it as Jar).archiveFile } .toTypedArray()) jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true") - group = "run paper" - runDirectory.set(file("run-$it")) + group = "run $software" + runDirectory.set(file("run-$software-$version")) + task(this) } } runServer { - minecraftVersion("1.20.4") - pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile } - .toTypedArray()) - + registerVersion("1.20.4", "paper") + } + supportedVersions.forEach { + registerVersion(it, "paper") } foliaSupportedVersions.forEach { - register("runFolia-$it") { + registerVersion(it, "folia") { downloadsApiService.set(xyz.jpenilla.runtask.service.DownloadsAPIService.folia(project)) - minecraftVersion(it) - group = "run folia" - runDirectory.set(file("run-folia-$it")) - pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile } - .toTypedArray()) } }