From a390119b0482028178dae4bd7089c7080d4af9b5 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sat, 27 Apr 2024 14:02:33 -0700 Subject: [PATCH] Move cb version definition to gradle patch --- .../server/0001-Setup-Gradle-project.patch | 9 ++++--- .../server/0003-Build-system-changes.patch | 12 +++++----- patches/server/0004-Test-changes.patch | 6 ++--- patches/server/0005-Paper-config-files.patch | 2 +- ...oleAppender-for-console-improvements.patch | 4 ++-- ...n-prefixes-using-Log4J-configuration.patch | 2 +- ...r-to-keep-logging-IO-off-main-thread.patch | 2 +- ...ktraces-in-log-messages-crash-report.patch | 4 ++-- patches/server/0020-Plugin-remapping.patch | 24 ++++--------------- 9 files changed, 26 insertions(+), 39 deletions(-) diff --git a/patches/server/0001-Setup-Gradle-project.patch b/patches/server/0001-Setup-Gradle-project.patch index d3e3f1ad9d..8160fcc0ff 100644 --- a/patches/server/0001-Setup-Gradle-project.patch +++ b/patches/server/0001-Setup-Gradle-project.patch @@ -28,10 +28,10 @@ index 37dab9e868dbfb019c271a547d975a48ad1cb571..3811c0d849a3eb028ed1a6b7a2d4747f +/.factorypath diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 -index 0000000000000000000000000000000000000000..a41b15de7eba00d62822f582015d324ccde7dfe7 +index 0000000000000000000000000000000000000000..0aa34e8bb81700a3660ba89b3e2a8f53f10ca34c --- /dev/null +++ b/build.gradle.kts -@@ -0,0 +1,119 @@ +@@ -0,0 +1,122 @@ +import io.papermc.paperweight.util.* + +plugins { @@ -60,7 +60,10 @@ index 0000000000000000000000000000000000000000..a41b15de7eba00d62822f582015d324c + testImplementation("org.ow2.asm:asm-tree:9.7") +} + -+val craftbukkitPackageVersion = "1_20_R4" // Paper ++paperweight { ++ craftBukkitPackageVersion.set("v1_20_R4") // also needs to be updated in MappingEnvironment ++} ++ +tasks.jar { + archiveClassifier.set("dev") + diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index f7608aaf06..460b6955db 100644 --- a/patches/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -9,7 +9,7 @@ public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/ Co-authored-by: Jake Potrebic diff --git a/build.gradle.kts b/build.gradle.kts -index a41b15de7eba00d62822f582015d324ccde7dfe7..4d38e90fddc74fb0b0d1be23990d35e60ccd9544 100644 +index 0aa34e8bb81700a3660ba89b3e2a8f53f10ca34c..0d0e1191df8c68fc7142d3d63bd9416477811a17 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,9 +8,7 @@ plugins { @@ -23,7 +23,7 @@ index a41b15de7eba00d62822f582015d324ccde7dfe7..4d38e90fddc74fb0b0d1be23990d35e6 implementation("org.ow2.asm:asm-commons:9.7") implementation("commons-lang:commons-lang:2.6") runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0") -@@ -35,6 +33,7 @@ tasks.jar { +@@ -38,6 +36,7 @@ tasks.jar { val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\"" val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper @@ -31,17 +31,17 @@ index a41b15de7eba00d62822f582015d324ccde7dfe7..4d38e90fddc74fb0b0d1be23990d35e6 attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "CraftBukkit", -@@ -43,6 +42,9 @@ tasks.jar { +@@ -46,6 +45,9 @@ tasks.jar { "Specification-Title" to "Bukkit", "Specification-Version" to project.version, "Specification-Vendor" to "Bukkit Team", + "Git-Branch" to gitBranch, // Paper + "Git-Commit" to gitHash, // Paper -+ "CraftBukkit-Package-Version" to craftbukkitPackageVersion, // Paper ++ "CraftBukkit-Package-Version" to paperweight.craftBukkitPackageVersion.get(), // Paper ) for (tld in setOf("net", "com", "org")) { attributes("$tld/bukkit", "Sealed" to true) -@@ -55,6 +57,17 @@ publishing { +@@ -58,6 +60,17 @@ publishing { } } @@ -59,7 +59,7 @@ index a41b15de7eba00d62822f582015d324ccde7dfe7..4d38e90fddc74fb0b0d1be23990d35e6 tasks.test { exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") useJUnitPlatform() -@@ -116,4 +129,5 @@ tasks.registerRunTask("runReobf") { +@@ -119,4 +132,5 @@ tasks.registerRunTask("runReobf") { tasks.registerRunTask("runDev") { description = "Spin up a non-relocated Mojang-mapped test server" classpath(sourceSets.main.map { it.runtimeClasspath }) diff --git a/patches/server/0004-Test-changes.patch b/patches/server/0004-Test-changes.patch index b504fb1161..5cbf59e0c5 100644 --- a/patches/server/0004-Test-changes.patch +++ b/patches/server/0004-Test-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Test changes diff --git a/build.gradle.kts b/build.gradle.kts -index 4d38e90fddc74fb0b0d1be23990d35e60ccd9544..583f2c236d98d2c8348787eadc813d1218e25336 100644 +index 0d0e1191df8c68fc7142d3d63bd9416477811a17..842a73be79b755009acd830760fe0d2b405c2a8e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,6 +22,7 @@ dependencies { @@ -15,8 +15,8 @@ index 4d38e90fddc74fb0b0d1be23990d35e60ccd9544..583f2c236d98d2c8348787eadc813d12 + testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest } - val craftbukkitPackageVersion = "1_20_R4" // Paper -@@ -52,6 +53,12 @@ tasks.jar { + paperweight { +@@ -55,6 +56,12 @@ tasks.jar { } } diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index 69e6aa4696..be80eac01f 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -15,7 +15,7 @@ public net.minecraft.server.dedicated.DedicatedServerProperties reload(Lnet/mine public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES diff --git a/build.gradle.kts b/build.gradle.kts -index 583f2c236d98d2c8348787eadc813d1218e25336..2a7db88148b708754d5f33ed5266ecefcad9d27c 100644 +index 842a73be79b755009acd830760fe0d2b405c2a8e..4640fc676ca3d4a9eb6276e027e086862ed655b0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,6 +10,7 @@ dependencies { diff --git a/patches/server/0011-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0011-Use-TerminalConsoleAppender-for-console-improvements.patch index b40a930712..619e4c4fce 100644 --- a/patches/server/0011-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0011-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -25,7 +25,7 @@ Other changes: Co-Authored-By: Emilia Kond diff --git a/build.gradle.kts b/build.gradle.kts -index 2a7db88148b708754d5f33ed5266ecefcad9d27c..0aed38d217707a916f2a42ede9525b88560b6c8b 100644 +index 4640fc676ca3d4a9eb6276e027e086862ed655b0..869df6523b3c502e0331810953cb8b3b30ae58a5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,9 +5,29 @@ plugins { @@ -59,7 +59,7 @@ index 2a7db88148b708754d5f33ed5266ecefcad9d27c..0aed38d217707a916f2a42ede9525b88 implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion implementation("org.ow2.asm:asm-commons:9.7") implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files -@@ -75,6 +95,19 @@ tasks.check { +@@ -78,6 +98,19 @@ tasks.check { dependsOn(scanJar) } // Paper end diff --git a/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch index 32b5c0e06d..5d7dbbe7b0 100644 --- a/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/build.gradle.kts b/build.gradle.kts -index 0aed38d217707a916f2a42ede9525b88560b6c8b..4260860c3dc0335b570899ab461c17f0ade00ed6 100644 +index 869df6523b3c502e0331810953cb8b3b30ae58a5..53b5724c16a54cb7ca0c3095724cd2a9271c98b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { diff --git a/patches/server/0014-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch b/patches/server/0014-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch index 3f7d87c091..24ca1b70d4 100644 --- a/patches/server/0014-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch +++ b/patches/server/0014-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread diff --git a/build.gradle.kts b/build.gradle.kts -index 4260860c3dc0335b570899ab461c17f0ade00ed6..d3005f310a256c000a62314832d5e90eecfefbf6 100644 +index 53b5724c16a54cb7ca0c3095724cd2a9271c98b9..90983bcc4ec752b6266afb70b5d9b939a1812815 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -32,8 +32,7 @@ dependencies { diff --git a/patches/server/0015-Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/0015-Deobfuscate-stacktraces-in-log-messages-crash-report.patch index 77aa4f4e51..d3bb2fee79 100644 --- a/patches/server/0015-Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/0015-Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and diff --git a/build.gradle.kts b/build.gradle.kts -index d3005f310a256c000a62314832d5e90eecfefbf6..3587ff0a4c0fe92c99501aa5251f379481e43437 100644 +index 90983bcc4ec752b6266afb70b5d9b939a1812815..f4198f997d82ccf761137cda8c1827e202686c75 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,6 +43,7 @@ dependencies { @@ -16,7 +16,7 @@ index d3005f310a256c000a62314832d5e90eecfefbf6..3587ff0a4c0fe92c99501aa5251f3794 + implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling } - val craftbukkitPackageVersion = "1_20_R4" // Paper + paperweight { diff --git a/src/log4jPlugins/java/io/papermc/paper/logging/StacktraceDeobfuscatingRewritePolicy.java b/src/log4jPlugins/java/io/papermc/paper/logging/StacktraceDeobfuscatingRewritePolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..66b6011ee3684695b2ab9292961c80bf2a420ee9 diff --git a/patches/server/0020-Plugin-remapping.patch b/patches/server/0020-Plugin-remapping.patch index 4f89a129ef..5becbea79c 100644 --- a/patches/server/0020-Plugin-remapping.patch +++ b/patches/server/0020-Plugin-remapping.patch @@ -6,34 +6,18 @@ Subject: [PATCH] Plugin remapping Co-authored-by: Nassim Jahnke diff --git a/build.gradle.kts b/build.gradle.kts -index 3587ff0a4c0fe92c99501aa5251f379481e43437..600b442986fa5ca9dd12f900caa284b854cc30ca 100644 +index f4198f997d82ccf761137cda8c1827e202686c75..600b442986fa5ca9dd12f900caa284b854cc30ca 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -44,9 +44,13 @@ dependencies { +@@ -44,6 +44,7 @@ dependencies { testImplementation("org.ow2.asm:asm-tree:9.7") testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling + implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins -+} -+ -+paperweight { -+ craftBukkitPackageVersion.set("v1_20_R4") // also needs to be updated in MappingEnvironment } --val craftbukkitPackageVersion = "1_20_R4" // Paper - tasks.jar { - archiveClassifier.set("dev") - -@@ -66,7 +70,7 @@ tasks.jar { - "Specification-Vendor" to "Bukkit Team", - "Git-Branch" to gitBranch, // Paper - "Git-Commit" to gitHash, // Paper -- "CraftBukkit-Package-Version" to craftbukkitPackageVersion, // Paper -+ "CraftBukkit-Package-Version" to paperweight.craftBukkitPackageVersion.get(), // Paper - ) - for (tld in setOf("net", "com", "org")) { - attributes("$tld/bukkit", "Sealed" to true) -@@ -155,20 +159,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM + paperweight { +@@ -158,20 +159,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM runtime.filterNot { it.asFile.absolutePath == vanilla } }