Setup dev bundle publishing (#6163)

This commit is contained in:
Jason 2021-08-17 17:11:04 -05:00 committed by GitHub
parent f2471d20b4
commit fa184f7429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 102 additions and 53 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

@ -28,10 +28,10 @@ index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..bb338269c9e3bef4c274157c490d8b8f
+/.factorypath +/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..e67df300ac722061765278680ff0afc042a6d0cb index 0000000000000000000000000000000000000000..71f781083f2f81d064605b2a652181f22b98733d
--- /dev/null --- /dev/null
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -0,0 +1,144 @@ @@ -0,0 +1,172 @@
+import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer +import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
+import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer +import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
+import io.papermc.paperweight.util.Git +import io.papermc.paperweight.util.Git
@ -104,19 +104,47 @@ index 0000000000000000000000000000000000000000..e67df300ac722061765278680ff0afc0
+ } + }
+} +}
+ +
+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)

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Build system changes
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index e67df300ac722061765278680ff0afc042a6d0cb..1ed07304bdf4288608dade345997802cb7753159 100644 index 71f781083f2f81d064605b2a652181f22b98733d..bacfd25d2fa07d2b0441494a39fe3830b7e4d1f0 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -18,21 +18,24 @@ repositories { @@ -18,21 +18,24 @@ repositories {
@ -45,7 +45,16 @@ index e67df300ac722061765278680ff0afc042a6d0cb..1ed07304bdf4288608dade345997802c
) )
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)
@@ -70,15 +74,23 @@ publishing { @@ -77,7 +81,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",
- "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) ->
@@ -102,9 +106,17 @@ relocation {
} }
} }
@ -60,16 +69,9 @@ index e67df300ac722061765278680ff0afc042a6d0cb..1ed07304bdf4288608dade345997802c
+ 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 1338f52370dafbb8820a67cc4528eb20e0b9155c..90af1b123722bac1c4c5956465a153ec1ea998ff 100644 index 1338f52370dafbb8820a67cc4528eb20e0b9155c..90af1b123722bac1c4c5956465a153ec1ea998ff 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java

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