From 48c1ea17c369c3ca272294d31ca0227cd976a07d Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Wed, 16 Jun 2021 16:23:02 -0700 Subject: [PATCH] Fix artifact ids --- Paper-MojangAPI/build.gradle.kts | 3 +++ patches/api/Convert-project-to-Gradle.patch | 1 + patches/server/Build-system-changes.patch | 16 ++++++------ patches/server/Setup-Gradle-project.patch | 28 +++++++++++---------- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Paper-MojangAPI/build.gradle.kts b/Paper-MojangAPI/build.gradle.kts index 0fdb8a028b..f7bf0ff771 100644 --- a/Paper-MojangAPI/build.gradle.kts +++ b/Paper-MojangAPI/build.gradle.kts @@ -1,3 +1,5 @@ +import java.util.Locale + plugins { `java-library` `maven-publish` @@ -27,6 +29,7 @@ dependencies { configure { publications.create("maven") { + artifactId = project.name.toLowerCase(Locale.ENGLISH) from(components["java"]) } } diff --git a/patches/api/Convert-project-to-Gradle.patch b/patches/api/Convert-project-to-Gradle.patch index 7080f250f5..931b4e5e45 100644 --- a/patches/api/Convert-project-to-Gradle.patch +++ b/patches/api/Convert-project-to-Gradle.patch @@ -55,6 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +configure { + publications.create("maven") { ++ artifactId = project.name.toLowerCase(Locale.ENGLISH) + from(components["java"]) + } +} diff --git a/patches/server/Build-system-changes.patch b/patches/server/Build-system-changes.patch index 5d31f9fa99..123ac9e3a6 100644 --- a/patches/server/Build-system-changes.patch +++ b/patches/server/Build-system-changes.patch @@ -38,22 +38,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 testImplementation("org.hamcrest:hamcrest-library:1.3") } @@ -0,0 +0,0 @@ tasks.jar { - "Implementation-Vendor" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(Date()), // Paper "Specification-Title" to "Bukkit", "Specification-Version" to project.version, -- "Specification-Vendor" to "Bukkit Team" -+ "Specification-Vendor" to "Bukkit Team", -+ "Multi-Release" to "true" // Paper - )) - for (tld in listOf("net", "com", "org")) { - attributes(mapOf( -@@ -0,0 +0,0 @@ configure { + "Specification-Vendor" to "Bukkit Team", ++ "Multi-Release" to "true", // Paper + ) + for (tld in setOf("net", "com", "org")) { + attributes("$tld/bukkit", "Sealed" to true) +@@ -0,0 +0,0 @@ publishing { } } +val generatePom = tasks.named("generatePomFileForMavenPublication") + tasks.shadowJar { + archiveClassifier.set("mojang-mapped") + + // Needed for Paperclip's install to maven local feature + from(generatePom) { + into("META-INF/maven/io.papermc.paper/paper") diff --git a/patches/server/Setup-Gradle-project.patch b/patches/server/Setup-Gradle-project.patch index 1662dce7f2..8ace742c0b 100644 --- a/patches/server/Setup-Gradle-project.patch +++ b/patches/server/Setup-Gradle-project.patch @@ -28,6 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import shadow.org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.PLUGIN_CACHE_FILE +import java.text.SimpleDateFormat +import java.util.Date ++import java.util.Locale + +plugins { + java @@ -64,38 +65,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +} + +tasks.jar { ++ archiveClassifier.set("dev") ++ + manifest { + val git = Git(rootProject.layout.projectDirectory.path) -+ val gitHashCmd = git("rev-parse", "HEAD") -+ val gitHash = gitHashCmd.getText().substring(0, 7) -+ attributes(mapOf( ++ val gitHash = git("rev-parse", "HEAD").getText().substring(0, 7) ++ attributes( + "Main-Class" to "org.bukkit.craftbukkit.Main", + "Implementation-Title" to "CraftBukkit", + "Implementation-Version" to "git-Paper-\"$gitHash\"", + "Implementation-Vendor" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(Date()), // Paper + "Specification-Title" to "Bukkit", + "Specification-Version" to project.version, -+ "Specification-Vendor" to "Bukkit Team" -+ )) -+ for (tld in listOf("net", "com", "org")) { -+ attributes(mapOf( -+ "Sealed" to "true" -+ ), "$tld/bukkit") ++ "Specification-Vendor" to "Bukkit Team", ++ ) ++ for (tld in setOf("net", "com", "org")) { ++ attributes("$tld/bukkit", "Sealed" to true) + } + } +} + -+configure { ++publishing { + publications.create("maven") { -+ // todo: confirm this is correct -+ from(components["java"]) ++ artifactId = rootProject.name.toLowerCase(Locale.ENGLISH) + artifact(tasks.reobfJar) { -+ classifier = "reobf" ++ classifier = null + } ++ artifact(tasks.shadowJar) + } +} + +tasks.shadowJar { ++ archiveClassifier.set("mojang-mapped") ++ + listOf( + "jline", "it.unimi", "org.apache.commons.codec", "org.apache.commons.io", + "org.apache.commons.lang3", "org.objectweb.asm"