Update paperweight to 2.0.0-beta.6

This commit is contained in:
Jason Penilla 2024-12-20 00:37:00 -08:00
parent fd1b6b1ae9
commit 6e0c8776e6
No known key found for this signature in database
GPG key ID: 0E75A301420E48F8
3 changed files with 66 additions and 64 deletions

View file

@ -1,4 +1,5 @@
import io.papermc.paperweight.util.* 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.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.io.IOException import java.io.IOException
@ -11,7 +12,7 @@ import java.nio.file.Path
import kotlin.random.Random import kotlin.random.Random
plugins { 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 { subprojects {
@ -146,19 +147,18 @@ tasks.register("checkWork") {
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().trim() val input = providers.fileContents(layout.projectDirectory.file("$CACHE_PATH/last-updating-folder")).asText.map { it.trim() }
val patchFolder = layout.projectDirectory.file("paper-server/patches/sources").convertToPath().resolve(input) val patchFolder = layout.projectDirectory.dir("paper-server/patches/sources").dir(input)
val sourceFolder = layout.projectDirectory.file("paper-server/src/vanilla/java/").convertToPath().resolve(input) val sourceFolder = layout.projectDirectory.dir("paper-server/src/vanilla/java").dir(input)
val targetFolder = expandUserHome( val targetFolder = providers.gradleProperty("cleanPaperRepo").map {
providers.gradleProperty("cleanPaperRepo").orNull expandUserHome(it).resolve(input.get())
?: error("cleanPaperRepo is required, define it in gradle.properties") }
).resolve(input)
fun copy(back: Boolean = false) { fun copy(back: Boolean = false) {
patchFolder.listDirectoryEntries().forEach { patchFolder.path.listDirectoryEntries().forEach {
val relative = patchFolder.relativize(it).toString().replace(".patch", "") val relative = patchFolder.path.relativize(it).toString().replace(".patch", "")
val source = sourceFolder.resolve(relative) val source = sourceFolder.path.resolve(relative)
val target = targetFolder.resolve(relative) val target = targetFolder.get().resolve(relative)
if (target.isDirectory()) { return@forEach } if (target.isDirectory()) { return@forEach }
if (back) { if (back) {
target.copyTo(source, overwrite = true) target.copyTo(source, overwrite = true)
@ -169,8 +169,11 @@ tasks.register("checkWork") {
} }
doLast { doLast {
if (!targetFolder.isPresent) {
error("cleanPaperRepo is required, define it in gradle.properties")
}
copy() 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("Copied $files from $sourceFolder to $targetFolder")
println("Make the files compile, then press enter to copy them back!") println("Make the files compile, then press enter to copy them back!")
System.`in`.read() System.`in`.read()

View file

@ -6,8 +6,7 @@ mcVersion=1.21.4
updatingMinecraft=false updatingMinecraft=false
updateTaskListIssue=https://github.com/PaperMC/Paper/issues/11736 updateTaskListIssue=https://github.com/PaperMC/Paper/issues/11736
# todo - bundler/paperclip tasks not compatible yet when using libraries org.gradle.configuration-cache=true
org.gradle.configuration-cache=false
org.gradle.caching=true org.gradle.caching=true
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.vfs.watch=false org.gradle.vfs.watch=false

View file

@ -13,7 +13,6 @@ val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
dependencies { dependencies {
mache("io.papermc:mache:1.21.4+build.6") mache("io.papermc:mache:1.21.4+build.6")
paperclip("io.papermc:paperclip:3.0.3") paperclip("io.papermc:paperclip:3.0.3")
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
} }
paperweight { paperweight {
@ -23,6 +22,13 @@ paperweight {
paper { paper {
reobfMappingsPatch = layout.projectDirectory.file("../build-data/reobf-mappings-patch.tiny") reobfMappingsPatch = layout.projectDirectory.file("../build-data/reobf-mappings-patch.tiny")
}
spigot {
buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42"
packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment
}
reobfPackagesToFix.addAll( reobfPackagesToFix.addAll(
"co.aikar.timings", "co.aikar.timings",
"com.destroystokyo.paper", "com.destroystokyo.paper",
@ -34,12 +40,6 @@ paperweight {
"org.bukkit.craftbukkit", "org.bukkit.craftbukkit",
"org.spigotmc", "org.spigotmc",
) )
}
spigot {
buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42"
packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment
}
} }
tasks.generateDevelopmentBundle { tasks.generateDevelopmentBundle {
@ -58,8 +58,7 @@ abstract class Services {
} }
val services = objects.newInstance<Services>() val services = objects.newInstance<Services>()
publishing { if (project.providers.gradleProperty("publishDevBundle").isPresent) {
if (project.providers.gradleProperty("publishDevBundle").isPresent) {
val devBundleComponent = services.softwareComponentFactory.adhoc("devBundle") val devBundleComponent = services.softwareComponentFactory.adhoc("devBundle")
components.add(devBundleComponent) components.add(devBundleComponent)
@ -97,6 +96,7 @@ publishing {
} }
} }
publishing {
publications.create<MavenPublication>("devBundle") { publications.create<MavenPublication>("devBundle") {
artifactId = "dev-bundle" artifactId = "dev-bundle"
from(devBundleComponent) from(devBundleComponent)
@ -317,21 +317,21 @@ tasks.registerRunTask("runDevServer") {
tasks.registerRunTask("runBundler") { tasks.registerRunTask("runBundler") {
description = "Spin up a test server from the Mojang mapped bundler jar" description = "Spin up a test server from the Mojang mapped bundler jar"
classpath(tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createMojmapBundlerJar").flatMap { it.outputZip }) classpath(tasks.createMojmapBundlerJar.flatMap { it.outputZip })
mainClass.set(null as String?) mainClass.set(null as String?)
} }
tasks.registerRunTask("runReobfBundler") { tasks.registerRunTask("runReobfBundler") {
description = "Spin up a test server from the reobf bundler jar" description = "Spin up a test server from the reobf bundler jar"
classpath(tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createReobfBundlerJar").flatMap { it.outputZip }) classpath(tasks.createReobfBundlerJar.flatMap { it.outputZip })
mainClass.set(null as String?) mainClass.set(null as String?)
} }
tasks.registerRunTask("runPaperclip") { tasks.registerRunTask("runPaperclip") {
description = "Spin up a test server from the Mojang mapped Paperclip jar" description = "Spin up a test server from the Mojang mapped Paperclip jar"
classpath(tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createMojmapPaperclipJar").flatMap { it.outputZip }) classpath(tasks.createMojmapPaperclipJar.flatMap { it.outputZip })
mainClass.set(null as String?) mainClass.set(null as String?)
} }
tasks.registerRunTask("runReobfPaperclip") { tasks.registerRunTask("runReobfPaperclip") {
description = "Spin up a test server from the reobf Paperclip jar" description = "Spin up a test server from the reobf Paperclip jar"
classpath(tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createReobfPaperclipJar").flatMap { it.outputZip }) classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip })
mainClass.set(null as String?) mainClass.set(null as String?)
} }