3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-14 18:40:10 +01:00

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
Dieser Commit ist enthalten in:
Jason Penilla 2024-04-04 17:12:05 -07:00 committet von GitHub
Ursprung e709245b55
Commit a2035440cf
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
15 geänderte Dateien mit 67 neuen und 79 gelöschten Zeilen

Datei anzeigen

@ -11,7 +11,7 @@ plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.core") version "1.5.12"
id("io.papermc.paperweight.core") version "1.5.13"
}
allprojects {

Datei anzeigen

@ -9,7 +9,7 @@ public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
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

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Test changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 517aaae21f8fbd6916ab23d85dac5f74aea9e984..9098a40f944a3c6c0e907013c212eb3f1895e010 100644
index ff9e7b4c4354d4475559213cdaa01728601859fa..5304f5de52a76eee876ac8f0b2834a93b28d57aa 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -23,6 +23,7 @@ dependencies {
@ -16,8 +16,8 @@ index 517aaae21f8fbd6916ab23d85dac5f74aea9e984..9098a40f944a3c6c0e907013c212eb3f
}
val craftbukkitPackageVersion = "1_20_R3" // Paper
@@ -58,6 +59,12 @@ tasks.compileJava {
options.setIncremental(false)
@@ -53,6 +54,12 @@ tasks.jar {
}
}
+// Paper start - compile tests with -parameters for better junit parameterized test names

Datei anzeigen

@ -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 9098a40f944a3c6c0e907013c212eb3f1895e010..f838b058e6cad9061929509047bbe25c65baecf6 100644
index beb50d67ea2c1933a115766627b2adabd2032929..b8970d0064b9b64e1c50ab373818c38611fd9f5e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,6 +11,7 @@ dependencies {
@ -4823,10 +4823,10 @@ index 0000000000000000000000000000000000000000..614aba60bb07946a144650fd3aedb316
+ protected abstract boolean belowZero(O value);
+}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 6b0a1ff870e013a83f7922021ab296bb1c716079..403c57fc683bb0497602e1a9ec7b81b2722ecc01 100644
index 602964d92ddf9e4ec47ed3cb45787fdd061a881e..66550ce5cc83534af8dcac338db5cd4cfb1c46c4 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -137,6 +137,10 @@ public class Main {
@@ -126,6 +126,10 @@ public class Main {
dedicatedserversettings.forceSave();
Path path2 = Paths.get("eula.txt");
Eula eula = new Eula(path2);
@ -4837,7 +4837,7 @@ index 6b0a1ff870e013a83f7922021ab296bb1c716079..403c57fc683bb0497602e1a9ec7b81b2
if (optionset.has("initSettings")) { // CraftBukkit
// CraftBukkit start - SPIGOT-5761: Create bukkit.yml and commands.yml if not present
@@ -171,7 +175,7 @@ public class Main {
@@ -160,7 +164,7 @@ public class Main {
}
File file = (File) optionset.valueOf("universe"); // CraftBukkit
@ -5069,10 +5069,10 @@ index 0000000000000000000000000000000000000000..0396589795da1f83ddf62426236dde9a
+ }
+}
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index a1c2c702cc6b5d949df62b5ecf4cc62b8e4e8f77..381c1d681a982e28f1909bd954d21827549f7bcc 100644
index 0619361adf57fdc41c4ecb09d1d6a5c862a85f89..b786ed8e620feb51baceae41dd2d1538dc298705 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -62,6 +62,7 @@ public abstract class AbstractTestingBase {
@@ -63,6 +63,7 @@ public abstract class AbstractTestingBase {
BIOMES = REGISTRY_CUSTOM.registryOrThrow(Registries.BIOME);
DummyServer.setup();

Datei anzeigen

@ -7152,10 +7152,10 @@ index 1eabd8b5a99850298838b11ba97e3d220f444378..8ff786c366332588a2df053438f23cc9
Bootstrap.wrapStreams();
Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 403c57fc683bb0497602e1a9ec7b81b2722ecc01..ba58580f4c60205d1c7a7b7dfcdc22c4fafc9bc6 100644
index 66550ce5cc83534af8dcac338db5cd4cfb1c46c4..a40755f2e4d36a3ef34e187727065da4b918a5e8 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -128,6 +128,7 @@ public class Main {
@@ -117,6 +117,7 @@ public class Main {
JvmProfiler.INSTANCE.start(Environment.SERVER);
}

Datei anzeigen

@ -25,7 +25,7 @@ Other changes:
Co-Authored-By: Emilia Kond <emilia@rymiel.space>
diff --git a/build.gradle.kts b/build.gradle.kts
index f838b058e6cad9061929509047bbe25c65baecf6..f4d33c9c4c04e1a09259dd9cc7cb909e30506580 100644
index 1219b12750edb855df0962d14d7f3c1859d78b2e..511dfff4870c197b6f69169cc0504ef05988bb9c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -6,9 +6,30 @@ plugins {
@ -60,7 +60,7 @@ index f838b058e6cad9061929509047bbe25c65baecf6..f4d33c9c4c04e1a09259dd9cc7cb909e
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
implementation("org.ow2.asm:asm-commons:9.5")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
@@ -80,7 +101,7 @@ relocation {
@@ -75,7 +96,7 @@ relocation {
}
tasks.shadowJar {
@ -413,7 +413,7 @@ index 827579f59d34b61912a67b40624f0f41524185fd..f7d937c6a11e24afe767411428210f3c
@Override
public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 4fb377d967d13ed920ea1246e84b3b94cda25be6..659b32d49016a23475f3bbda1548a78101b468ce 100644
index adae906894144a1684a0dab15226649fd4bf6354..1bd54fbadc9b1b5207325c78298cc72f61455ac7 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -13,7 +13,6 @@ import java.util.logging.Logger;

Datei anzeigen

@ -580,10 +580,10 @@ index 722dcae9ab65bcacb9fb89dfaa63715d87816476..c57e8b6458800fe9bb27050eecc42bd3
* Calculates distance between 2 entities
* @param e1
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index ba58580f4c60205d1c7a7b7dfcdc22c4fafc9bc6..5374a6b70a9780cfe9f62207b290b9a3ab82c7e9 100644
index a40755f2e4d36a3ef34e187727065da4b918a5e8..d46b7bff34b9b43e895f713d2e73071bc62de443 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -176,7 +176,7 @@ public class Main {
@@ -165,7 +165,7 @@ public class Main {
}
File file = (File) optionset.valueOf("universe"); // CraftBukkit

Datei anzeigen

@ -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 b48f8b7e248eb2349c7f06fdf282b741a91554d9..753624bbd4f051952c22cea9902de706626fa2ba 100644
index 1eedfc00ab7da96f07ae542b8c5775f41708dd37..dc552a35977b2e62ec1534ffbb9c744135b4b3fc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -35,6 +35,7 @@ dependencies {
@ -17,7 +17,7 @@ index b48f8b7e248eb2349c7f06fdf282b741a91554d9..753624bbd4f051952c22cea9902de706
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
runtimeOnly("com.mysql:mysql-connector-j:8.2.0")
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
@@ -126,6 +127,18 @@ tasks.check {
@@ -121,6 +122,18 @@ tasks.check {
}
// Paper end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 5374a6b70a9780cfe9f62207b290b9a3ab82c7e9..976d5e9c965324537720e38acf6a6deda079a324 100644
index d46b7bff34b9b43e895f713d2e73071bc62de443..567ca2f09d7bf03ef1758459829a865e5b0f3edf 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -175,8 +175,17 @@ public class Main {
@@ -164,8 +164,17 @@ public class Main {
return;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 976d5e9c965324537720e38acf6a6deda079a324..a99fddc55bf125fe6de7be254e9f9384c2bf9ba3 100644
index 567ca2f09d7bf03ef1758459829a865e5b0f3edf..4e3001d46340cc18108683c024f6ebe12266dd32 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -175,6 +175,7 @@ public class Main {
@@ -164,6 +164,7 @@ public class Main {
return;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add environment variable to disable server gui
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index a99fddc55bf125fe6de7be254e9f9384c2bf9ba3..7a5e70c99716273d04f4cd28d80a38f6f6b3868e 100644
index 4e3001d46340cc18108683c024f6ebe12266dd32..d3b1fa89c1ae96abebfc0a792f2bc592de05443f 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -325,6 +325,7 @@ public class Main {
@@ -314,6 +314,7 @@ public class Main {
*/
boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");

Datei anzeigen

@ -27,10 +27,10 @@ index 6bd0afddbcc461149dfe9a5c7a86fff6ea13a5f1..148d233f4f5278ff39eacdaa0f4f0e7d
+ }
}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 7a5e70c99716273d04f4cd28d80a38f6f6b3868e..aa19a24b10cc6f4f79bb9ad65f92f60735ac5387 100644
index d3b1fa89c1ae96abebfc0a792f2bc592de05443f..953e228afc6f706b819bb26655b91761436cc68d 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -175,6 +175,18 @@ public class Main {
@@ -164,6 +164,18 @@ public class Main {
return;
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Fix demo flag not enabling demo mode
https://github.com/PaperMC/Paper/issues/9046
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index aa19a24b10cc6f4f79bb9ad65f92f60735ac5387..deb2d8c22a1c5724d0ac8571f4ea54711988dc4b 100644
index 953e228afc6f706b819bb26655b91761436cc68d..2906cb10461b5334a7555046384c28848eec149f 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -332,7 +332,9 @@ public class Main {
@@ -321,7 +321,9 @@ public class Main {
/*
dedicatedserver1.setPort((Integer) optionset.valueOf(optionspec10));

Datei anzeigen

@ -15508,10 +15508,10 @@ index 0000000000000000000000000000000000000000..c78cbec447032de9fe69748591bef6be
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index deb2d8c22a1c5724d0ac8571f4ea54711988dc4b..72d013d06705b08ed696e3d3b6d631d65800c2c9 100644
index 2906cb10461b5334a7555046384c28848eec149f..329471af4f40e0a74612707cce96bb00819e6cf2 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -327,6 +327,7 @@ public class Main {
@@ -316,6 +316,7 @@ public class Main {
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
*/

Datei anzeigen

@ -247,10 +247,10 @@ index 0000000000000000000000000000000000000000..513833c2ea23df5b079d157bc5cb89d5
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 72d013d06705b08ed696e3d3b6d631d65800c2c9..61840cfd64caba6595dfc99c91c76a195638d4ee 100644
index 329471af4f40e0a74612707cce96bb00819e6cf2..bc391d27399d8c22e78735ca39aa8ab45efb6413 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -399,6 +399,15 @@ public class Main {
@@ -388,6 +388,15 @@ public class Main {
return new WorldLoader.InitConfig(worldloader_d, Commands.CommandSelection.DEDICATED, serverPropertiesHandler.functionPermissionLevel);
}