Fix CB lib relocation (#6454)

This commit is contained in:
Jake Potrebic 2021-08-22 10:22:57 -07:00 committed by GitHub
parent b37fbbca3d
commit 98fa136099
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View file

@ -28,10 +28,10 @@ index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..bb338269c9e3bef4c274157c490d8b8f
+/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..71f781083f2f81d064605b2a652181f22b98733d
index 0000000000000000000000000000000000000000..6f084d7500d9de76604440bdcc582be1af04fc8c
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,172 @@
@@ -0,0 +1,173 @@
+import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
+import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
+import io.papermc.paperweight.util.Git
@ -105,6 +105,12 @@ index 0000000000000000000000000000000000000000..71f781083f2f81d064605b2a652181f2
+}
+
+relocation {
+ // Order matters here - e.g. craftbukkit proper must be relocated before any of the libs are relocated into the cb package
+ val packageVersion = "1_17_R1"
+ relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$packageVersion") {
+ exclude("org.bukkit.craftbukkit.Main*")
+ }
+
+ fun cb(pack: String) = "org.bukkit.craftbukkit.libs.$pack"
+
+ sequenceOf(
@ -129,11 +135,6 @@ index 0000000000000000000000000000000000000000..71f781083f2f81d064605b2a652181f2
+ ).forEach { pack ->
+ relocate(pack to cb(pack))
+ }
+
+ val packageVersion = "1_17_R1"
+ relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$packageVersion") {
+ exclude("org.bukkit.craftbukkit.Main*")
+ }
+}
+
+tasks.shadowJar {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Build system changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 71f781083f2f81d064605b2a652181f22b98733d..bacfd25d2fa07d2b0441494a39fe3830b7e4d1f0 100644
index 6f084d7500d9de76604440bdcc582be1af04fc8c..d97e9ba4432fc87c84f9f128820ff741464e1e25 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -18,21 +18,24 @@ repositories {
@ -45,7 +45,7 @@ index 71f781083f2f81d064605b2a652181f22b98733d..bacfd25d2fa07d2b0441494a39fe3830
)
for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true)
@@ -77,7 +81,7 @@ relocation {
@@ -83,7 +87,7 @@ relocation {
"org.jline:jline-terminal-jansi" to "jline",
"commons-codec:commons-codec" to "org.apache.commons.codec",
"commons-io:commons-io" to "org.apache.commons.io",
@ -54,7 +54,7 @@ index 71f781083f2f81d064605b2a652181f22b98733d..bacfd25d2fa07d2b0441494a39fe3830
"org.apache.commons:commons-lang3" to "org.apache.commons.lang3",
"org.ow2.asm:asm" to "org.objectweb.asm"
).forEach { (owner, pack) ->
@@ -102,9 +106,17 @@ relocation {
@@ -103,9 +107,17 @@ relocation {
}
}

View file

@ -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 7933b1594253ca13ad50ebca077c2e98f3021fa3..805820262d075728dc2a85e47bb32b19f5f5abfa 100644
index 5ee1e44647cfd7dff08ba7ce17d4b04246b7ab57..dc17410ac88e9f069a48ce7eb94b7cbec8e61c74 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,8 +1,12 @@
@ -46,7 +46,7 @@ index 7933b1594253ca13ad50ebca077c2e98f3021fa3..805820262d075728dc2a85e47bb32b19
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
testImplementation("junit:junit:4.13.1")
testImplementation("org.hamcrest:hamcrest-library:1.3")
@@ -142,6 +156,44 @@ tasks.shadowJar {
@@ -143,6 +157,44 @@ tasks.shadowJar {
transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java)
}