From f79625df9f72e818c9dfc9173d092b444791afc1 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 12 Dec 2024 12:22:30 +0100 Subject: [PATCH] Task fixups --- .gitignore | 7 ------- build.gradle.kts | 15 ++++++++++++--- gradle.properties | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 2fc295e654..e08033d541 100644 --- a/.gitignore +++ b/.gitignore @@ -13,13 +13,6 @@ build/ nbproject/ nbactions.xml -# we use maven! -build.xml - -# maven -target/ -dependency-reduced-pom.xml - # vim .*.sw[a-p] diff --git a/build.gradle.kts b/build.gradle.kts index 999008851a..5d06d6a89a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -71,18 +71,21 @@ subprojects { } tasks.register("printMinecraftVersion") { + val mcVersion = providers.gradleProperty("mcVersion") doLast { - println(providers.gradleProperty("mcVersion").get().trim()) + println(mcVersion.get().trim()) } } tasks.register("printPaperVersion") { + val paperVersion = provider { project.version } doLast { - println(project.version) + println(paperVersion.get()) } } tasks.register("gibWork") { + notCompatibleWithConfigurationCache("This task is interactive") @OptIn(ExperimentalPathApi::class) doLast { val issue = providers.gradleProperty("updateTaskListIssue").get() @@ -109,6 +112,7 @@ tasks.register("gibWork") { } tasks.register("showWork") { + notCompatibleWithConfigurationCache("This task is interactive") doLast { val parent = layout.projectDirectory.dir("paper-server/patches/unapplied/").convertToPath() Files.walkFileTree(parent, object : SimpleFileVisitor() { @@ -123,11 +127,16 @@ tasks.register("showWork") { } tasks.register("checkWork") { + notCompatibleWithConfigurationCache("This task is interactive") + fun expandUserHome(path: String): Path { + return Path.of(path.replaceFirst("^~".toRegex(), System.getProperty("user.home"))) + } + doLast { val input = project.findProperty("input") as String? ?: error("Input property is required. Use gradlew checkWork -Pinput=net/minecraft/server/MinecraftServer.java") val file = layout.projectDirectory.file("paper-server/src/vanilla/java/").convertToPath().resolve(input) - val target = Path.of(providers.gradleProperty("cleanPaperRepo").get()).resolve(input) + val target = expandUserHome(providers.gradleProperty("cleanPaperRepo").get()).resolve(input) file.copyTo(target, overwrite = true) println("Copied $file to $target") println("Make it compile, then press enter to copy it back!") diff --git a/gradle.properties b/gradle.properties index 8989546485..3bf9414dba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ mcVersion=1.21.4 # Set to true while updating Minecraft version updatingMinecraft=false -#cleanPaperRepo=F:\\Projects\\Paper121\\Paper-Server\\src\\main\\java +#cleanPaperRepo=~/IdeaProjects/Paper/Paper-Server/src/main/java updateTaskListIssue=https://github.com/PaperMC/testing/issues/2 org.gradle.configuration-cache=true