mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-19 05:30:23 -07:00
remove input param from checkWork task, remove configuration cache warnings
This commit is contained in:
parent
f79625df9f
commit
71ce2bc90a
@ -85,10 +85,12 @@ tasks.register("printPaperVersion") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("gibWork") {
|
tasks.register("gibWork") {
|
||||||
notCompatibleWithConfigurationCache("This task is interactive")
|
val issue = providers.gradleProperty("updateTaskListIssue").get()
|
||||||
|
val patchesFolder = layout.projectDirectory.dir("paper-server/patches/").convertToPath()
|
||||||
|
val storage = layout.cache.resolve("last-updating-folder").also { it.parent.createDirectories() }
|
||||||
|
|
||||||
@OptIn(ExperimentalPathApi::class)
|
@OptIn(ExperimentalPathApi::class)
|
||||||
doLast {
|
doLast {
|
||||||
val issue = providers.gradleProperty("updateTaskListIssue").get()
|
|
||||||
val html = URI(issue).toURL().readText()
|
val html = URI(issue).toURL().readText()
|
||||||
|
|
||||||
val beginMarker = "```[tasklist]"
|
val beginMarker = "```[tasklist]"
|
||||||
@ -99,26 +101,30 @@ tasks.register("gibWork") {
|
|||||||
val next = taskList.split("\\n").first { it.startsWith("- [ ]") }.replace("- [ ] ", "")
|
val next = taskList.split("\\n").first { it.startsWith("- [ ]") }.replace("- [ ] ", "")
|
||||||
|
|
||||||
println("checking out $next...")
|
println("checking out $next...")
|
||||||
val dir = layout.projectDirectory.dir("paper-server/patches/unapplied/").convertToPath().resolve(next)
|
val dir = patchesFolder.resolve("unapplied").resolve(next)
|
||||||
|
if (!dir.exists()) {
|
||||||
|
error("Unapplied patch folder $next does not exist, did someone else already check it out and forgot to mark it?")
|
||||||
|
}
|
||||||
dir.copyToRecursively(
|
dir.copyToRecursively(
|
||||||
layout.projectDirectory.dir("paper-server/patches/sources").convertToPath().resolve(next)
|
patchesFolder.resolve("sources").resolve(next)
|
||||||
.also { it.createDirectories() }, overwrite = true, followLinks = false
|
.also { it.createDirectories() }, overwrite = true, followLinks = false
|
||||||
)
|
)
|
||||||
dir.deleteRecursively()
|
dir.deleteRecursively()
|
||||||
|
|
||||||
|
storage.writeText(next)
|
||||||
println("please tick the box in the issue: $issue")
|
println("please tick the box in the issue: $issue")
|
||||||
println("if you don't finish it, uncheck the task again after you commited")
|
println("if you don't finish it, uncheck the task again after you commited")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("showWork") {
|
tasks.register("showWork") {
|
||||||
notCompatibleWithConfigurationCache("This task is interactive")
|
val patchDir = layout.projectDirectory.dir("paper-server/patches/unapplied/").convertToPath()
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val parent = layout.projectDirectory.dir("paper-server/patches/unapplied/").convertToPath()
|
Files.walkFileTree(patchDir, object : SimpleFileVisitor<Path>() {
|
||||||
Files.walkFileTree(parent, object : SimpleFileVisitor<Path>() {
|
|
||||||
override fun postVisitDirectory(dir: Path?, exc: IOException?): FileVisitResult {
|
override fun postVisitDirectory(dir: Path?, exc: IOException?): FileVisitResult {
|
||||||
dir?.takeIf { it.listDirectoryEntries("*.patch").isNotEmpty() }?.let {
|
dir?.takeIf { it.listDirectoryEntries("*.patch").isNotEmpty() }?.let {
|
||||||
println("- [ ] ${parent.relativize(it).pathString.replace("\\", "/")}")
|
println("- [ ] ${patchDir.relativize(it).pathString.replace("\\", "/")}")
|
||||||
}
|
}
|
||||||
return FileVisitResult.CONTINUE
|
return FileVisitResult.CONTINUE
|
||||||
}
|
}
|
||||||
@ -127,21 +133,38 @@ tasks.register("showWork") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("checkWork") {
|
tasks.register("checkWork") {
|
||||||
notCompatibleWithConfigurationCache("This task is interactive")
|
|
||||||
fun expandUserHome(path: String): Path {
|
fun expandUserHome(path: String): Path {
|
||||||
return Path.of(path.replaceFirst("^~".toRegex(), System.getProperty("user.home")))
|
return Path.of(path.replaceFirst("^~".toRegex(), System.getProperty("user.home")))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val input = layout.cache.resolve("last-updating-folder").readText()
|
||||||
|
val patchFolder = layout.projectDirectory.file("paper-server/patches/sources").convertToPath().resolve(input)
|
||||||
|
val sourceFolder = layout.projectDirectory.file("paper-server/src/vanilla/java/").convertToPath().resolve(input)
|
||||||
|
val targetFolder = expandUserHome(
|
||||||
|
providers.gradleProperty("cleanPaperRepo").orNull
|
||||||
|
?: error("cleanPaperRepo is required, define it in gradle.properties")
|
||||||
|
).resolve(input)
|
||||||
|
|
||||||
|
fun copy(back: Boolean = false) {
|
||||||
|
patchFolder.listDirectoryEntries().forEach {
|
||||||
|
val relative = patchFolder.relativize(it).toString().replace(".patch", "")
|
||||||
|
val source = sourceFolder.resolve(relative)
|
||||||
|
val target = targetFolder.resolve(relative)
|
||||||
|
if (back) {
|
||||||
|
target.copyTo(source, overwrite = true)
|
||||||
|
} else {
|
||||||
|
source.copyTo(target, overwrite = true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val input = project.findProperty("input") as String?
|
copy()
|
||||||
?: error("Input property is required. Use gradlew checkWork -Pinput=net/minecraft/server/MinecraftServer.java")
|
val files = patchFolder.listDirectoryEntries().map { it.fileName.toString().replace(".patch", "") }
|
||||||
val file = layout.projectDirectory.file("paper-server/src/vanilla/java/").convertToPath().resolve(input)
|
println("Copied $files from $sourceFolder to $targetFolder")
|
||||||
val target = expandUserHome(providers.gradleProperty("cleanPaperRepo").get()).resolve(input)
|
println("Make the files compile, then press enter to copy them back!")
|
||||||
file.copyTo(target, overwrite = true)
|
|
||||||
println("Copied $file to $target")
|
|
||||||
println("Make it compile, then press enter to copy it back!")
|
|
||||||
System.`in`.read()
|
System.`in`.read()
|
||||||
target.copyTo(file, overwrite = true)
|
copy(back = true)
|
||||||
println("copied back!")
|
println("copied back!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user