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

@ -1,11 +1,13 @@
plugins { plugins {
java java
`maven-publish`
id("com.github.johnrengelman.shadow") version "7.0.0" apply false id("com.github.johnrengelman.shadow") version "7.0.0" apply false
id("io.papermc.paperweight.core") version "1.1.9" id("io.papermc.paperweight.core") version "1.1.10"
} }
allprojects { allprojects {
apply(plugin = "java") apply(plugin = "java")
apply(plugin = "maven-publish")
java { java {
toolchain { toolchain {
@ -15,9 +17,6 @@ allprojects {
} }
subprojects { subprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release.set(16) options.release.set(16)
@ -29,16 +28,6 @@ subprojects {
filteringCharset = Charsets.UTF_8.name() filteringCharset = Charsets.UTF_8.name()
} }
configure<PublishingExtension> {
repositories {
maven {
name = "paperSnapshots"
url = uri("https://papermc.io/repo/repository/maven-snapshots/")
credentials(PasswordCredentials::class)
}
}
}
if (name == "Paper-MojangAPI") { if (name == "Paper-MojangAPI") {
return@subprojects return@subprojects
} }
@ -62,21 +51,11 @@ repositories {
onlyForConfigurations("paperclip") onlyForConfigurations("paperclip")
} }
} }
maven("https://maven.quiltmc.org/repository/release/") {
content {
onlyForConfigurations("paramMappings", "remapper")
}
}
maven("https://files.minecraftforge.net/maven/") {
content {
onlyForConfigurations("decompiler")
}
}
} }
dependencies { dependencies {
paramMappings("org.quiltmc:yarn:1.17.1+build.1:mergedv2") paramMappings("org.quiltmc:yarn:1.17.1+build.1:mergedv2")
remapper("org.quiltmc:tiny-remapper:0.4.1") remapper("org.quiltmc:tiny-remapper:0.4.3:fat")
decompiler("net.minecraftforge:forgeflower:1.5.498.12") decompiler("net.minecraftforge:forgeflower:1.5.498.12")
paperclip("io.papermc:paperclip:2.0.1") paperclip("io.papermc:paperclip:2.0.1")
} }
@ -89,6 +68,10 @@ paperweight {
spigotApiPatchDir.set(layout.projectDirectory.dir("patches/api")) spigotApiPatchDir.set(layout.projectDirectory.dir("patches/api"))
spigotServerPatchDir.set(layout.projectDirectory.dir("patches/server")) spigotServerPatchDir.set(layout.projectDirectory.dir("patches/server"))
paramMappingsRepo.set("https://maven.quiltmc.org/repository/release/")
remapRepo.set("https://maven.quiltmc.org/repository/release/")
decompileRepo.set("https://files.minecraftforge.net/maven/")
mappingsPatch.set(layout.projectDirectory.file("build-data/mappings-patch.tiny")) mappingsPatch.set(layout.projectDirectory.file("build-data/mappings-patch.tiny"))
reobfMappingsPatch.set(layout.projectDirectory.file("build-data/reobf-mappings-patch.tiny")) reobfMappingsPatch.set(layout.projectDirectory.file("build-data/reobf-mappings-patch.tiny"))
@ -108,6 +91,42 @@ paperweight {
} }
} }
tasks.generateDevelopmentBundle {
apiCoordinates.set("io.papermc.paper:paper-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
libraryRepositories.set(
listOf(
"https://libraries.minecraft.net/",
"https://maven.quiltmc.org/repository/release/",
"https://repo.aikar.co/content/groups/aikar",
"https://ci.emc.gs/nexus/content/groups/aikar/",
"https://papermc.io/repo/repository/maven-public/"
)
)
}
publishing {
if (project.hasProperty("publishDevBundle")) {
publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) {
artifactId = "dev-bundle"
}
}
}
}
allprojects {
publishing {
repositories {
maven {
name = "paperSnapshots"
url = uri("https://papermc.io/repo/repository/maven-snapshots/")
credentials(PasswordCredentials::class)
}
}
}
}
tasks.register("printMinecraftVersion") { tasks.register("printMinecraftVersion") {
doLast { doLast {
println(providers.gradleProperty("mcVersion").get().trim()) println(providers.gradleProperty("mcVersion").get().trim())

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

2
gradlew vendored
View file

@ -72,7 +72,7 @@ case "`uname`" in
Darwin* ) Darwin* )
darwin=true darwin=true
;; ;;
MINGW* ) MSYS* | MINGW* )
msys=true msys=true
;; ;;
NONSTOP* ) NONSTOP* )

View file

@ -45,7 +45,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
) )
for (tld in setOf("net", "com", "org")) { for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true) attributes("$tld/bukkit", "Sealed" to true)
@@ -0,0 +0,0 @@ publishing { @@ -0,0 +0,0 @@ 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",
- "it.unimi.dsi:fastutil" to "it.unimi",
+ //"it.unimi.dsi:fastutil" to "it.unimi", // Paper - don't relocate fastutil
"org.apache.commons:commons-lang3" to "org.apache.commons.lang3",
"org.ow2.asm:asm" to "org.objectweb.asm"
).forEach { (owner, pack) ->
@@ -0,0 +0,0 @@ relocation {
} }
} }
@ -60,16 +69,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ rename { "pom.xml" } + rename { "pom.xml" }
+ } + }
+ +
val packageVersion = "1_17_R1" for (relocation in relocation.relocations.get()) {
relocate("org.bukkit.craftbukkit", "org.bukkit.craftbukkit.v$packageVersion") { relocate(relocation.fromPackage, relocation.toPackage) {
exclude("org.bukkit.craftbukkit.Main*") for (exclude in relocation.excludes) {
}
listOf(
- "jline", "it.unimi", "org.apache.commons.codec", "org.apache.commons.io",
+ "jline", "org.apache.commons.codec", "org.apache.commons.io", // Paper - don't relocate fastutil
"org.apache.commons.lang3", "org.apache.http", "org.apache.maven", "org.codehaus.plexus",
"org.eclipse.aether", "org.eclipse.sisu", "org.objectweb.asm"
).forEach { pack ->
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java

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 { +tasks.shadowJar {
+ archiveClassifier.set("mojang-mapped") + archiveClassifier.set("mojang-mapped")
+ +
+ val packageVersion = "1_17_R1" + for (relocation in relocation.relocations.get()) {
+ relocate("org.bukkit.craftbukkit", "org.bukkit.craftbukkit.v$packageVersion") { + relocate(relocation.fromPackage, relocation.toPackage) {
+ exclude("org.bukkit.craftbukkit.Main*") + for (exclude in relocation.excludes) {
+ } + exclude(exclude)
+ 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")
+ } + }
+ mergeServiceFiles() + mergeServiceFiles()
+ transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java) + transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java)