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/
nbactions.xml
# we use maven!
build.xml
# maven
target/
dependency-reduced-pom.xml
# vim
.*.sw[a-p]

View file

@ -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<Path>() {
@ -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!")

View file

@ -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