diff options
author | Jason Penilla <[email protected]> | 2024-04-04 17:12:05 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-04 17:12:05 -0700 |
commit | a2035440cfe3ec829513a74b1309859fc15be972 (patch) | |
tree | b352f0afec6040796d8796f6cf714e18be64266e /patches/server/0003-Build-system-changes.patch | |
parent | e709245b5566229ed5c262b310bcd1a1e71a8918 (diff) | |
download | Paper-a2035440cfe3ec829513a74b1309859fc15be972.tar.gz Paper-a2035440cfe3ec829513a74b1309859fc15be972.zip |
build: Compile against and shade the filtered jar (#9747)
* Compile against & shade the filtered jar
* Move check for if the paper asset root needs to be pushed
* Don't disable incremental compilation
* Remove mavenLocal
* use paperweight release
Diffstat (limited to 'patches/server/0003-Build-system-changes.patch')
-rw-r--r-- | patches/server/0003-Build-system-changes.patch | 80 |
1 files changed, 34 insertions, 46 deletions
diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index b483193167..d5d9b33f1c 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 <[email protected]> diff --git a/build.gradle.kts b/build.gradle.kts -index 74849d7b20e3c3831a6a6c3715a6e875d6ff8a48..517aaae21f8fbd6916ab23d85dac5f74aea9e984 100644 +index 74849d7b20e3c3831a6a6c3715a6e875d6ff8a48..ff9e7b4c4354d4475559213cdaa01728601859fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,9 +9,7 @@ plugins { @@ -41,19 +41,7 @@ index 74849d7b20e3c3831a6a6c3715a6e875d6ff8a48..517aaae21f8fbd6916ab23d85dac5f74 ) for (tld in setOf("net", "com", "org")) { attributes("$tld/bukkit", "Sealed" to true) -@@ -51,6 +53,11 @@ tasks.jar { - } - } - -+tasks.compileJava { -+ // incremental compilation is currently broken due to patched files having compiled counterparts already on the compile classpath -+ options.setIncremental(false) -+} -+ - publishing { - publications.create<MavenPublication>("maven") { - artifact(tasks.shadowJar) -@@ -77,6 +84,17 @@ tasks.shadowJar { +@@ -77,6 +79,17 @@ tasks.shadowJar { } } @@ -71,21 +59,11 @@ index 74849d7b20e3c3831a6a6c3715a6e875d6ff8a48..517aaae21f8fbd6916ab23d85dac5f74 tasks.test { exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") useJUnitPlatform() -@@ -135,7 +153,14 @@ tasks.registerRunTask("runReobf") { - classpath(runtimeClasspathWithoutVanillaServer) - } - -+val runtimeClasspathForRunDev = sourceSets.main.flatMap { src -> -+ src.runtimeClasspath.elements.map { elements -> -+ elements.filterNot { file -> file.asFile.endsWith("minecraft.jar") } -+ } -+} +@@ -138,4 +151,5 @@ tasks.registerRunTask("runReobf") { tasks.registerRunTask("runDev") { description = "Spin up a non-relocated Mojang-mapped test server" -- classpath(sourceSets.main.map { it.runtimeClasspath }) -+ classpath(tasks.filterProjectDir.flatMap { it.outputJar }) -+ classpath(runtimeClasspathForRunDev) -+ jvmArgs("-DPaper.isRunDev=true") + classpath(sourceSets.main.map { it.runtimeClasspath }) ++ jvmArgs("-DPaper.pushPaperAssetsRoot=true") } diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java index 68e3d54c79924d72b22eb3bc142ff47aa1700895..d3300e43523429fdd0e61c5aa9aed2e6bc78e07e 100644 @@ -99,27 +77,25 @@ index 68e3d54c79924d72b22eb3bc142ff47aa1700895..d3300e43523429fdd0e61c5aa9aed2e6 private final String namespace; private final String path; -diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 602964d92ddf9e4ec47ed3cb45787fdd061a881e..6b0a1ff870e013a83f7922021ab296bb1c716079 100644 ---- a/src/main/java/net/minecraft/server/Main.java -+++ b/src/main/java/net/minecraft/server/Main.java -@@ -105,6 +105,17 @@ public class Main { - */ // CraftBukkit end +diff --git a/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java b/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java +index 1b65823e6c2070761dd08ce801268e95dad13065..978dd399430ae98d54fc4805800aa0214d4034e3 100644 +--- a/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java ++++ b/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java +@@ -141,6 +141,15 @@ public class VanillaPackResourcesBuilder { - try { -+ // Paper start -+ if (Boolean.getBoolean("Paper.isRunDev")) { -+ net.minecraft.server.packs.VanillaPackResourcesBuilder.developmentConfig = builder -> { -+ try { -+ builder.pushAssetPath(net.minecraft.server.packs.PackType.SERVER_DATA, net.minecraft.server.packs.VanillaPackResourcesBuilder.safeGetPath(java.util.Objects.requireNonNull(Main.class.getResource("/data/.paperassetsroot"), "Missing required .paperassetsroot file").toURI()).getParent()); -+ } catch (java.net.URISyntaxException | IOException ex) { -+ throw new RuntimeException(ex); -+ } -+ }; + public VanillaPackResourcesBuilder applyDevelopmentConfig() { + developmentConfig.accept(this); ++ if (Boolean.getBoolean("Paper.pushPaperAssetsRoot")) { ++ try { ++ this.pushAssetPath(net.minecraft.server.packs.PackType.SERVER_DATA, net.minecraft.server.packs.VanillaPackResourcesBuilder.safeGetPath(java.util.Objects.requireNonNull( ++ // Important that this is a patched class ++ VanillaPackResourcesBuilder.class.getResource("/data/.paperassetsroot"), "Missing required .paperassetsroot file").toURI()).getParent()); ++ } catch (java.net.URISyntaxException | IOException ex) { ++ throw new RuntimeException(ex); + } -+ // Paper end - - Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit ++ } + return this; + } diff --git a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java index a2a8bce29ec5540de89095574dfdc0ca9b17bbd3..d92cd89373f8373c367ce422328b9836de09096d 100644 @@ -163,3 +139,15 @@ index 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed4 diff --git a/src/main/resources/data/.paperassetsroot b/src/main/resources/data/.paperassetsroot new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 +diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java +index a1c2c702cc6b5d949df62b5ecf4cc62b8e4e8f77..0619361adf57fdc41c4ecb09d1d6a5c862a85f89 100644 +--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java ++++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java +@@ -43,6 +43,7 @@ public abstract class AbstractTestingBase { + public static final Registry<Biome> BIOMES; + + static { ++ System.setProperty("Paper.pushPaperAssetsRoot", "true"); // Paper + SharedConstants.tryDetectVersion(); + Bootstrap.bootStrap(); + // Populate available packs |