From 83767f95444adb9778e81bcc51b6c6e5746c0f87 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sat, 27 Apr 2024 17:27:32 -0700 Subject: [PATCH] Use JetBrains runtime for run tasks allows for better runtime class redefinition closes #10459 --- patches/server/0001-Setup-Gradle-project.patch | 10 +++++++--- patches/server/0003-Build-system-changes.patch | 4 ++-- patches/server/0004-Test-changes.patch | 2 +- patches/server/0005-Paper-config-files.patch | 2 +- ...minalConsoleAppender-for-console-improvements.patch | 2 +- ...dle-plugin-prefixes-using-Log4J-configuration.patch | 2 +- ...ncAppender-to-keep-logging-IO-off-main-thread.patch | 2 +- ...cate-stacktraces-in-log-messages-crash-report.patch | 2 +- patches/server/0020-Plugin-remapping.patch | 4 ++-- ...p-reflection-calls-in-plugins-using-internals.patch | 2 +- patches/server/0282-Brigadier-Mojang-API.patch | 2 +- patches/server/0362-Implement-Mob-Goal-API.patch | 2 +- .../server/0722-Add-support-for-Proxy-Protocol.patch | 2 +- ...1-Use-Velocity-compression-and-cipher-natives.patch | 2 +- 14 files changed, 22 insertions(+), 18 deletions(-) diff --git a/patches/server/0001-Setup-Gradle-project.patch b/patches/server/0001-Setup-Gradle-project.patch index 8160fcc0ff..0305c825b8 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..0aa34e8bb81700a3660ba89b3e2a8f53f10ca34c +index 0000000000000000000000000000000000000000..a457cf30d37037ce09fbe5d26e051b9555ce9982 --- /dev/null +++ b/build.gradle.kts -@@ -0,0 +1,122 @@ +@@ -0,0 +1,126 @@ +import io.papermc.paperweight.util.* + +plugins { @@ -107,7 +107,11 @@ index 0000000000000000000000000000000000000000..0aa34e8bb81700a3660ba89b3e2a8f53 + workingDir = rootProject.layout.projectDirectory + .dir(providers.gradleProperty("paper.runWorkDir").getOrElse("run")) + .asFile -+ javaLauncher.set(project.javaToolchains.launcherFor(project.java.toolchain)) ++ javaLauncher.set(project.javaToolchains.launcherFor { ++ languageVersion.set(JavaLanguageVersion.of(21)) ++ vendor.set(JvmVendorSpec.JETBRAINS) ++ }) ++ jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods") + + if (rootProject.childProjects["test-plugin"] != null) { + val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile } diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index 460b6955db..dc7013b1d8 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 0aa34e8bb81700a3660ba89b3e2a8f53f10ca34c..0d0e1191df8c68fc7142d3d63bd9416477811a17 100644 +index a457cf30d37037ce09fbe5d26e051b9555ce9982..9ca8ddea1d53076e0f23c6e3bf3e3eca5cceb393 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,9 +8,7 @@ plugins { @@ -59,7 +59,7 @@ index 0aa34e8bb81700a3660ba89b3e2a8f53f10ca34c..0d0e1191df8c68fc7142d3d63bd94164 tasks.test { exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") useJUnitPlatform() -@@ -119,4 +132,5 @@ tasks.registerRunTask("runReobf") { +@@ -123,4 +136,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 5cbf59e0c5..48a991bbfe 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 0d0e1191df8c68fc7142d3d63bd9416477811a17..842a73be79b755009acd830760fe0d2b405c2a8e 100644 +index 9ca8ddea1d53076e0f23c6e3bf3e3eca5cceb393..2f73e709dcde063ec7ca2181f2f2d5670fd479f5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,6 +22,7 @@ dependencies { diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index 8442ee0f87..6c9bbfce19 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 842a73be79b755009acd830760fe0d2b405c2a8e..4640fc676ca3d4a9eb6276e027e086862ed655b0 100644 +index 2f73e709dcde063ec7ca2181f2f2d5670fd479f5..18221614060ec945cb8b197acd276e45450f7394 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 619e4c4fce..1e2b0376b9 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 4640fc676ca3d4a9eb6276e027e086862ed655b0..869df6523b3c502e0331810953cb8b3b30ae58a5 100644 +index 18221614060ec945cb8b197acd276e45450f7394..f7a1c358b0caf524707dcf1346d1d5a22500ce59 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,9 +5,29 @@ plugins { 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 5d7dbbe7b0..4071c81565 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 869df6523b3c502e0331810953cb8b3b30ae58a5..53b5724c16a54cb7ca0c3095724cd2a9271c98b9 100644 +index f7a1c358b0caf524707dcf1346d1d5a22500ce59..1d9baec8ebafb694e259af6a24892a899791a550 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 1e4bea02b6..b149928c11 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 53b5724c16a54cb7ca0c3095724cd2a9271c98b9..1f6df49819af1c698806c1cf0d35269505881de2 100644 +index 1d9baec8ebafb694e259af6a24892a899791a550..cce667165ade3e42792516a4721c74b35e7caa2c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,6 +34,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 02122e5b49..c1defa02b5 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 1f6df49819af1c698806c1cf0d35269505881de2..0c2b0a06b4a4226e4cd2c3846ab8c9b4eb5d913e 100644 +index cce667165ade3e42792516a4721c74b35e7caa2c..65fb16941fa7e3a9b300696fb6bd2b562bca48cd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -45,6 +45,7 @@ dependencies { diff --git a/patches/server/0020-Plugin-remapping.patch b/patches/server/0020-Plugin-remapping.patch index 7d7a65bda0..e2804ec264 100644 --- a/patches/server/0020-Plugin-remapping.patch +++ b/patches/server/0020-Plugin-remapping.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Plugin remapping Co-authored-by: Nassim Jahnke diff --git a/build.gradle.kts b/build.gradle.kts -index 0c2b0a06b4a4226e4cd2c3846ab8c9b4eb5d913e..e1588bbfdcfe601de2435b0b8f9bba3a2855411d 100644 +index 65fb16941fa7e3a9b300696fb6bd2b562bca48cd..5ffd1d7c130e01a4a7516b361e48bfaf41d4f321 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,6 +46,7 @@ dependencies { @@ -17,7 +17,7 @@ index 0c2b0a06b4a4226e4cd2c3846ab8c9b4eb5d913e..e1588bbfdcfe601de2435b0b8f9bba3a } paperweight { -@@ -160,20 +161,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM +@@ -164,20 +165,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM runtime.filterNot { it.asFile.absolutePath == vanilla } } diff --git a/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch b/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch index 1dd7e21516..f24134e203 100644 --- a/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch +++ b/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Remap reflection calls in plugins using internals Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> diff --git a/build.gradle.kts b/build.gradle.kts -index e1588bbfdcfe601de2435b0b8f9bba3a2855411d..b6af3dc3f1a247c6c2ee5c040786ef21f71425ee 100644 +index 5ffd1d7c130e01a4a7516b361e48bfaf41d4f321..e9498f78cb6c0973a820f093ff7a31bef44ba27f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -47,6 +47,12 @@ dependencies { diff --git a/patches/server/0282-Brigadier-Mojang-API.patch b/patches/server/0282-Brigadier-Mojang-API.patch index b7aa6edfb3..55b1c9b8a9 100644 --- a/patches/server/0282-Brigadier-Mojang-API.patch +++ b/patches/server/0282-Brigadier-Mojang-API.patch @@ -10,7 +10,7 @@ Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client diff --git a/build.gradle.kts b/build.gradle.kts -index b6af3dc3f1a247c6c2ee5c040786ef21f71425ee..dac5aa09674a8220154403e126c275481f76ed92 100644 +index e9498f78cb6c0973a820f093ff7a31bef44ba27f..db2d67c98c62aa90591fea82e8fb07270699d96c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,6 +13,7 @@ val alsoShade: Configuration by configurations.creating diff --git a/patches/server/0362-Implement-Mob-Goal-API.patch b/patches/server/0362-Implement-Mob-Goal-API.patch index 1dee6e1616..56f3af0c73 100644 --- a/patches/server/0362-Implement-Mob-Goal-API.patch +++ b/patches/server/0362-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index dac5aa09674a8220154403e126c275481f76ed92..869de96d874ba52823b4b5f19398d38d46172a5b 100644 +index db2d67c98c62aa90591fea82e8fb07270699d96c..7a70c2c52dec44d6b6c7acc7140b2619e56646d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -41,6 +41,7 @@ dependencies { diff --git a/patches/server/0722-Add-support-for-Proxy-Protocol.patch b/patches/server/0722-Add-support-for-Proxy-Protocol.patch index b6d5d54b9a..1ffaba0911 100644 --- a/patches/server/0722-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0722-Add-support-for-Proxy-Protocol.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add support for Proxy Protocol diff --git a/build.gradle.kts b/build.gradle.kts -index 869de96d874ba52823b4b5f19398d38d46172a5b..db349c954f95bb8a26e3570983d99ab197d74c4d 100644 +index 7a70c2c52dec44d6b6c7acc7140b2619e56646d0..9b9e744d18cf66279f51f950b6ecce31415f9fa8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,6 +28,7 @@ dependencies { diff --git a/patches/server/1011-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/1011-Use-Velocity-compression-and-cipher-natives.patch index 5677c523de..659e02628d 100644 --- a/patches/server/1011-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/1011-Use-Velocity-compression-and-cipher-natives.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives diff --git a/build.gradle.kts b/build.gradle.kts -index db349c954f95bb8a26e3570983d99ab197d74c4d..898bd00a37455d6e7b5e4f52b17c127bd71f2563 100644 +index 9b9e744d18cf66279f51f950b6ecce31415f9fa8..5d448d8a7cf6626a11791f30ad52baf41a099272 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,6 +37,11 @@ dependencies {