Task fixups

This commit is contained in:
Nassim Jahnke 2024-12-12 12:22:30 +01:00
parent 45ddf764d9
commit f79625df9f
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
3 changed files with 13 additions and 11 deletions

7
.gitignore vendored
View file

@ -13,13 +13,6 @@ build/
nbproject/ nbproject/
nbactions.xml nbactions.xml
# we use maven!
build.xml
# maven
target/
dependency-reduced-pom.xml
# vim # vim
.*.sw[a-p] .*.sw[a-p]

View file

@ -71,18 +71,21 @@ subprojects {
} }
tasks.register("printMinecraftVersion") { tasks.register("printMinecraftVersion") {
val mcVersion = providers.gradleProperty("mcVersion")
doLast { doLast {
println(providers.gradleProperty("mcVersion").get().trim()) println(mcVersion.get().trim())
} }
} }
tasks.register("printPaperVersion") { tasks.register("printPaperVersion") {
val paperVersion = provider { project.version }
doLast { doLast {
println(project.version) println(paperVersion.get())
} }
} }
tasks.register("gibWork") { tasks.register("gibWork") {
notCompatibleWithConfigurationCache("This task is interactive")
@OptIn(ExperimentalPathApi::class) @OptIn(ExperimentalPathApi::class)
doLast { doLast {
val issue = providers.gradleProperty("updateTaskListIssue").get() val issue = providers.gradleProperty("updateTaskListIssue").get()
@ -109,6 +112,7 @@ tasks.register("gibWork") {
} }
tasks.register("showWork") { tasks.register("showWork") {
notCompatibleWithConfigurationCache("This task is interactive")
doLast { doLast {
val parent = layout.projectDirectory.dir("paper-server/patches/unapplied/").convertToPath() val parent = layout.projectDirectory.dir("paper-server/patches/unapplied/").convertToPath()
Files.walkFileTree(parent, object : SimpleFileVisitor<Path>() { Files.walkFileTree(parent, object : SimpleFileVisitor<Path>() {
@ -123,11 +127,16 @@ tasks.register("showWork") {
} }
tasks.register("checkWork") { tasks.register("checkWork") {
notCompatibleWithConfigurationCache("This task is interactive")
fun expandUserHome(path: String): Path {
return Path.of(path.replaceFirst("^~".toRegex(), System.getProperty("user.home")))
}
doLast { doLast {
val input = project.findProperty("input") as String? val input = project.findProperty("input") as String?
?: error("Input property is required. Use gradlew checkWork -Pinput=net/minecraft/server/MinecraftServer.java") ?: 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 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) file.copyTo(target, overwrite = true)
println("Copied $file to $target") println("Copied $file to $target")
println("Make it compile, then press enter to copy it back!") println("Make it compile, then press enter to copy it back!")

View file

@ -4,7 +4,7 @@ mcVersion=1.21.4
# Set to true while updating Minecraft version # Set to true while updating Minecraft version
updatingMinecraft=false 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 updateTaskListIssue=https://github.com/PaperMC/testing/issues/2
org.gradle.configuration-cache=true org.gradle.configuration-cache=true