Start cleaning up plugin remapping patches

This commit is contained in:
Jason Penilla 2024-04-27 13:27:01 -07:00
parent 0b1b1fe067
commit e2552eea24
No known key found for this signature in database
GPG Key ID: 0E75A301420E48F8
1033 changed files with 57 additions and 143 deletions

View File

@ -28,16 +28,15 @@ index 37dab9e868dbfb019c271a547d975a48ad1cb571..3811c0d849a3eb028ed1a6b7a2d4747f
+/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..e69d74d671b1b73f32eac47d620ec364f419bd6c
index 0000000000000000000000000000000000000000..b3055953028759e4754d507c31f387b6bf7c0108
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,124 @@
@@ -0,0 +1,119 @@
+import io.papermc.paperweight.util.*
+
+plugins {
+ java
+ `maven-publish`
+ id("com.github.johnrengelman.shadow")
+}
+
+dependencies {
@ -90,10 +89,6 @@ index 0000000000000000000000000000000000000000..e69d74d671b1b73f32eac47d620ec364
+ }
+}
+
+tasks.shadowJar {
+ configurations = listOf(project.configurations.vanillaServer.get())
+}
+
+tasks.test {
+ exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
+ useJUnitPlatform()

View File

@ -9,10 +9,10 @@ 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 e69d74d671b1b73f32eac47d620ec364f419bd6c..9d425351f32739eb6c18ebc5c36545c1be21d436 100644
index b3055953028759e4754d507c31f387b6bf7c0108..39e4021d3fa7e79bd28463a01e3e6d07181f6765 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,9 +9,7 @@ plugins {
@@ -8,9 +8,7 @@ plugins {
dependencies {
implementation(project(":paper-api"))
implementation("jline:jline:2.12.1")
@ -23,7 +23,7 @@ index e69d74d671b1b73f32eac47d620ec364f419bd6c..9d425351f32739eb6c18ebc5c36545c1
implementation("org.ow2.asm:asm-commons:9.7")
implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0")
@@ -36,6 +34,7 @@ tasks.jar {
@@ -35,6 +33,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,7 +31,7 @@ index e69d74d671b1b73f32eac47d620ec364f419bd6c..9d425351f32739eb6c18ebc5c36545c1
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@@ -44,6 +43,9 @@ tasks.jar {
@@ -43,6 +42,9 @@ tasks.jar {
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
"Specification-Vendor" to "Bukkit Team",
@ -41,14 +41,14 @@ index e69d74d671b1b73f32eac47d620ec364f419bd6c..9d425351f32739eb6c18ebc5c36545c1
)
for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true)
@@ -60,6 +62,17 @@ tasks.shadowJar {
configurations = listOf(project.configurations.vanillaServer.get())
@@ -55,6 +57,17 @@ publishing {
}
}
+// Paper start
+val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
+ badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
+ jarToScan.set(tasks.shadowJar.flatMap { it.archiveFile })
+ jarToScan.set(tasks.serverJar.flatMap { it.archiveFile })
+ classpath.from(configurations.compileClasspath)
+}
+tasks.check {
@ -59,7 +59,7 @@ index e69d74d671b1b73f32eac47d620ec364f419bd6c..9d425351f32739eb6c18ebc5c36545c1
tasks.test {
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
useJUnitPlatform()
@@ -121,4 +134,5 @@ tasks.registerRunTask("runReobf") {
@@ -116,4 +129,5 @@ tasks.registerRunTask("runReobf") {
tasks.registerRunTask("runDev") {
description = "Spin up a non-relocated Mojang-mapped test server"
classpath(sourceSets.main.map { it.runtimeClasspath })

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Test changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 9d425351f32739eb6c18ebc5c36545c1be21d436..db90a1c1409cc7a58f35d2e9ae768f2edd3f36ae 100644
index 39e4021d3fa7e79bd28463a01e3e6d07181f6765..83598b48724e3a4f40a153be3e681564105b90b4 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -23,6 +23,7 @@ dependencies {
@@ -22,6 +22,7 @@ dependencies {
testImplementation("org.hamcrest:hamcrest:2.2")
testImplementation("org.mockito:mockito-core:5.11.0")
testImplementation("org.ow2.asm:asm-tree:9.7")
@ -16,7 +16,7 @@ index 9d425351f32739eb6c18ebc5c36545c1be21d436..db90a1c1409cc7a58f35d2e9ae768f2e
}
val craftbukkitPackageVersion = "1_20_R4" // Paper
@@ -53,6 +54,12 @@ tasks.jar {
@@ -52,6 +53,12 @@ tasks.jar {
}
}

View File

@ -15,10 +15,10 @@ 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 db90a1c1409cc7a58f35d2e9ae768f2edd3f36ae..c0a078302223202db37d2ed9ecf20716ed7706a5 100644
index 83598b48724e3a4f40a153be3e681564105b90b4..94fcbfae0678391d38ee8e6e54576d9fb294585e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,6 +11,7 @@ dependencies {
@@ -10,6 +10,7 @@ dependencies {
implementation("jline:jline:2.12.1")
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
implementation("org.ow2.asm:asm-commons:9.7")

View File

@ -25,11 +25,11 @@ Other changes:
Co-Authored-By: Emilia Kond <emilia@rymiel.space>
diff --git a/build.gradle.kts b/build.gradle.kts
index c0a078302223202db37d2ed9ecf20716ed7706a5..7fb99f67edf961bb31e3f77049d2d3eb7bb148bc 100644
index 94fcbfae0678391d38ee8e6e54576d9fb294585e..3dc1e82536e1e84287499825ab191c4e92bc37d7 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -6,9 +6,30 @@ plugins {
id("com.github.johnrengelman.shadow")
@@ -5,9 +5,30 @@ plugins {
`maven-publish`
}
+val log4jPlugins = sourceSets.create("log4jPlugins")
@ -60,15 +60,26 @@ index c0a078302223202db37d2ed9ecf20716ed7706a5..7fb99f67edf961bb31e3f77049d2d3eb
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
@@ -67,7 +88,7 @@ publishing {
@@ -75,6 +96,19 @@ tasks.check {
dependsOn(scanJar)
}
// Paper end
+// Paper start - use TCA for console improvements
+tasks.serverJar {
+ from(alsoShade.elements.map {
+ it.map { f ->
+ if (f.asFile.isFile) {
+ zipTree(f.asFile)
+ } else {
+ f.asFile
+ }
+ }
+ })
+}
+// Paper end - use TCA for console improvements
tasks.shadowJar {
- configurations = listOf(project.configurations.vanillaServer.get())
+ configurations = listOf(project.configurations.vanillaServer.get(), alsoShade) // Paper
}
// Paper start
tasks.test {
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
diff --git a/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java b/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java
new file mode 100644
index 0000000000000000000000000000000000000000..91547f6e6fe90006713beb2818da634304bdd236

View File

@ -15,10 +15,10 @@ 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 7fb99f67edf961bb31e3f77049d2d3eb7bb148bc..012dbc51b70e24d01e03df5471196249cd534bb8 100644
index 3dc1e82536e1e84287499825ab191c4e92bc37d7..5b5bcb37cf3a318fa80e6b594b0b900f50a471cc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -25,7 +25,7 @@ dependencies {
@@ -24,7 +24,7 @@ dependencies {
all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread
diff --git a/build.gradle.kts b/build.gradle.kts
index 012dbc51b70e24d01e03df5471196249cd534bb8..c0cde2b74865070c6901cbc5809e8f79d14969b2 100644
index 5b5bcb37cf3a318fa80e6b594b0b900f50a471cc..37bf660248173c25ec379639faece55c9e1207ce 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -34,8 +34,7 @@ dependencies {
@@ -33,8 +33,7 @@ dependencies {
implementation("org.ow2.asm:asm-commons:9.7")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6")

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and
diff --git a/build.gradle.kts b/build.gradle.kts
index c0cde2b74865070c6901cbc5809e8f79d14969b2..cc8f024fec9c1f928e0d218d19794eb1478f5d07 100644
index 37bf660248173c25ec379639faece55c9e1207ce..71da2755ac2253b73b128cf8f1afe9cf5e537912 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -34,6 +34,7 @@ dependencies {
@@ -33,6 +33,7 @@ dependencies {
implementation("org.ow2.asm:asm-commons:9.7")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6")

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Plugin remapping
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
diff --git a/build.gradle.kts b/build.gradle.kts
index cc8f024fec9c1f928e0d218d19794eb1478f5d07..5f94206910467c3302da5a995da5f74961a3365a 100644
index 71da2755ac2253b73b128cf8f1afe9cf5e537912..8e2a118be60e100a057d863457eee57ee34147bd 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -46,9 +46,14 @@ dependencies {
@@ -45,9 +45,14 @@ dependencies {
testImplementation("org.mockito:mockito-core:5.11.0")
testImplementation("org.ow2.asm:asm-tree:9.7")
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
@ -25,7 +25,7 @@ index cc8f024fec9c1f928e0d218d19794eb1478f5d07..5f94206910467c3302da5a995da5f749
tasks.jar {
archiveClassifier.set("dev")
@@ -68,7 +73,7 @@ tasks.jar {
@@ -67,7 +72,7 @@ tasks.jar {
"Specification-Vendor" to "Bukkit Team",
"Git-Branch" to gitBranch, // Paper
"Git-Commit" to gitHash, // Paper
@ -34,7 +34,7 @@ index cc8f024fec9c1f928e0d218d19794eb1478f5d07..5f94206910467c3302da5a995da5f749
)
for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true)
@@ -148,20 +153,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM
@@ -156,20 +161,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM
runtime.filterNot { it.asFile.absolutePath == vanilla }
}

View File

@ -6,10 +6,10 @@ 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 5f94206910467c3302da5a995da5f74961a3365a..b995ea46b0fabdab6d398aa1980f9d801460b772 100644
index 8e2a118be60e100a057d863457eee57ee34147bd..5e0200abc509989d79a5f3dd2ee456b7a3fca33f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -34,7 +34,6 @@ dependencies {
@@ -33,7 +33,6 @@ dependencies {
implementation("org.ow2.asm:asm-commons:9.7")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
@ -17,7 +17,7 @@ index 5f94206910467c3302da5a995da5f74961a3365a..b995ea46b0fabdab6d398aa1980f9d80
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
@@ -48,6 +47,12 @@ dependencies {
@@ -47,6 +46,12 @@ dependencies {
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins
implementation("net.neoforged:srgutils:1.0.9") // Paper - remap plugins - bump transitive of ART

View File

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Mon, 12 Feb 2024 22:19:03 -0700
Subject: [PATCH] Add WorldEdit plugin flag test task
diff --git a/build.gradle.kts b/build.gradle.kts
index b995ea46b0fabdab6d398aa1980f9d801460b772..2902bbff8d4aff8d09eaa6b7e4f6c604c42dac29 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,9 +1,11 @@
import io.papermc.paperweight.util.*
+import xyz.jpenilla.runpaper.task.RunServer
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow")
+ id("xyz.jpenilla.run-paper") version "2.2.3" apply false
}
val log4jPlugins = sourceSets.create("log4jPlugins")
@@ -176,6 +178,25 @@ tasks.registerRunTask("runDevServer") {
jvmArgs("-DPaper.pushPaperAssetsRoot=true")
}
+tasks.register<RunServer>("runWithPlugins") {
+ version.set(providers.gradleProperty("mcVersion"))
+ runJar(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createMojmapBundlerJar").flatMap { it.outputZip })
+ downloadPlugins {
+ url("https://ci.enginehub.org/repository/download/bt10/23382:id/worldedit-bukkit-7.2.19-dist.jar?branch=version/7.2.x&guest=1")
+ url("https://www.patreon.com/file?h=89830486&i=15920178")
+ url("https://dev.bukkit.org/projects/grief-prevention/files/4433061/download")
+ github("EssentialsX", "Essentials", "2.20.1", "EssentialsX-2.20.1.jar")
+ hangar("squaremap", "1.2.3")
+ hangar("FancyHolograms", "2.0.5")
+ hangar("Chunky", "1.3.92")
+ hangar("Multiverse-Core", "4.3.12")
+ // Once they fix package parsing
+ // hangar("Denizen", "1.3.0-Build-1803")
+ // hangar("GrimAnticheat", "2.3.58")
+ // hangar("ProtocolLib", "5.1.0")
+ }
+ runDirectory.set(rootProject.layout.projectDirectory.dir("run"))
+}
tasks.registerRunTask("runBundler") {
description = "Spin up a test server from the Mojang mapped bundler jar"
classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createMojmapBundlerJar").flatMap { it.outputZip })

View File

@ -1,44 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Thu, 18 Apr 2024 13:39:18 -0700
Subject: [PATCH] build: replace use of shadow plugin
diff --git a/build.gradle.kts b/build.gradle.kts
index 2902bbff8d4aff8d09eaa6b7e4f6c604c42dac29..fec06ac47cf190bf4d5d743c34e4a90b99a0af18 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,7 +4,6 @@ import xyz.jpenilla.runpaper.task.RunServer
plugins {
java
`maven-publish`
- id("com.github.johnrengelman.shadow")
id("xyz.jpenilla.run-paper") version "2.2.3" apply false
}
@@ -99,14 +98,22 @@ publishing {
}
}
-tasks.shadowJar {
- configurations = listOf(project.configurations.vanillaServer.get(), alsoShade) // Paper
+tasks.serverJar {
+ from(alsoShade.elements.map {
+ it.map { f ->
+ if (f.asFile.isFile) {
+ zipTree(f.asFile)
+ } else {
+ f.asFile
+ }
+ }
+ })
}
// Paper start
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
- jarToScan.set(tasks.shadowJar.flatMap { it.archiveFile })
+ jarToScan.set(tasks.serverJar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}
tasks.check {

Some files were not shown because too many files have changed in this diff Show More