Setup dev bundle publishing (#6163)

This commit is contained in:
Jason Penilla
2021-08-17 17:11:04 -05:00
parent 972fbb74c9
commit 6216cdc4c2
6 changed files with 97 additions and 48 deletions

View File

@@ -104,19 +104,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+}
+
+relocation {
+ fun cb(pack: String) = "org.bukkit.craftbukkit.libs.$pack"
+
+ sequenceOf(
+ "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",
+ "it.unimi.dsi:fastutil" to "it.unimi",
+ "org.apache.commons:commons-lang3" to "org.apache.commons.lang3",
+ "org.ow2.asm:asm" to "org.objectweb.asm"
+ ).forEach { (owner, pack) ->
+ relocate(owner, pack to cb(pack))
+ }
+
+ // runtimeOnly dependencies don't need an owner attached
+ // owner is used for dev bundle generation, runtimeOnly deps are not included in dev bundle
+ sequenceOf(
+ "org.apache.http",
+ "org.apache.maven",
+ "org.codehaus.plexus",
+ "org.eclipse.aether",
+ "org.eclipse.sisu"
+ ).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 {
+ archiveClassifier.set("mojang-mapped")
+
+ val packageVersion = "1_17_R1"
+ relocate("org.bukkit.craftbukkit", "org.bukkit.craftbukkit.v$packageVersion") {
+ exclude("org.bukkit.craftbukkit.Main*")
+ }
+ listOf(
+ "jline", "it.unimi", "org.apache.commons.codec", "org.apache.commons.io",
+ "org.apache.commons.lang3", "org.apache.http", "org.apache.maven", "org.codehaus.plexus",
+ "org.eclipse.aether", "org.eclipse.sisu", "org.objectweb.asm"
+ ).forEach { pack ->
+ relocate(pack, "org.bukkit.craftbukkit.libs.$pack")
+ for (relocation in relocation.relocations.get()) {
+ relocate(relocation.fromPackage, relocation.toPackage) {
+ for (exclude in relocation.excludes) {
+ exclude(exclude)
+ }
+ }
+ }
+ mergeServiceFiles()
+ transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java)