aboutsummaryrefslogtreecommitdiffhomepage
path: root/build.gradle.kts
diff options
context:
space:
mode:
Diffstat (limited to 'build.gradle.kts')
-rw-r--r--build.gradle.kts29
1 files changed, 16 insertions, 13 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index f2fae287ad..3ae1c411ae 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,5 @@
import io.papermc.paperweight.util.*
+import io.papermc.paperweight.util.constants.*
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.io.IOException
@@ -11,7 +12,7 @@ import java.nio.file.Path
import kotlin.random.Random
plugins {
- id("io.papermc.paperweight.core") version "2.0.0-beta.5" apply false
+ id("io.papermc.paperweight.core") version "2.0.0-beta.6" apply false
}
subprojects {
@@ -146,19 +147,18 @@ tasks.register("checkWork") {
return Path.of(path.replaceFirst("^~".toRegex(), System.getProperty("user.home")))
}
- val input = layout.cache.resolve("last-updating-folder").readText().trim()
- 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)
+ val input = providers.fileContents(layout.projectDirectory.file("$CACHE_PATH/last-updating-folder")).asText.map { it.trim() }
+ val patchFolder = layout.projectDirectory.dir("paper-server/patches/sources").dir(input)
+ val sourceFolder = layout.projectDirectory.dir("paper-server/src/vanilla/java").dir(input)
+ val targetFolder = providers.gradleProperty("cleanPaperRepo").map {
+ expandUserHome(it).resolve(input.get())
+ }
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)
+ patchFolder.path.listDirectoryEntries().forEach {
+ val relative = patchFolder.path.relativize(it).toString().replace(".patch", "")
+ val source = sourceFolder.path.resolve(relative)
+ val target = targetFolder.get().resolve(relative)
if (target.isDirectory()) { return@forEach }
if (back) {
target.copyTo(source, overwrite = true)
@@ -169,8 +169,11 @@ tasks.register("checkWork") {
}
doLast {
+ if (!targetFolder.isPresent) {
+ error("cleanPaperRepo is required, define it in gradle.properties")
+ }
copy()
- val files = patchFolder.listDirectoryEntries().map { it.fileName.toString().replace(".patch", "") }
+ val files = patchFolder.path.listDirectoryEntries().map { it.fileName.toString().replace(".patch", "") }
println("Copied $files from $sourceFolder to $targetFolder")
println("Make the files compile, then press enter to copy them back!")
System.`in`.read()