mirror of
https://github.com/GeyserMC/PackConverter.git
synced 2025-12-19 14:59:21 +00:00
Proper publishing setup (#17)
* Attempt at fixing published artifact * wohoo it works * attempt at excluding bootstrap's shadow jar from publishing * Update gradle, fix publishing (aka, dont publish shadowed bootstrap build to maven) * Don't apply shadow plugin for the converter * why are we publishing the lib as an artifact...? * make these implementation * Shade bedrock-pack-schema into pack-schema-api
This commit is contained in:
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -47,14 +47,6 @@ jobs:
|
|||||||
path: bootstrap/build/libs/PackConverter.jar
|
path: bootstrap/build/libs/PackConverter.jar
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Archive artifacts (Converter)
|
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
|
||||||
if: success()
|
|
||||||
with:
|
|
||||||
name: PackConverter Library
|
|
||||||
path: converter/build/libs/PackConverter-lib.jar
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
- name: Publish to Maven Repository
|
- name: Publish to Maven Repository
|
||||||
if: ${{ success() && github.repository == 'GeyserMC/PackConverter' && github.ref_name == 'master' }}
|
if: ${{ success() && github.repository == 'GeyserMC/PackConverter' && github.ref_name == 'master' }}
|
||||||
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5
|
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("application")
|
`java-library`
|
||||||
|
application
|
||||||
|
id("com.github.johnrengelman.shadow") apply true
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
resources {
|
||||||
|
srcDir("src/main/java/resources")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -11,10 +21,5 @@ application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||||
from("src/main/java/resources") {
|
|
||||||
include("*")
|
|
||||||
}
|
|
||||||
|
|
||||||
archiveFileName.set("PackConverter.jar")
|
archiveFileName.set("PackConverter.jar")
|
||||||
archiveClassifier.set("")
|
|
||||||
}
|
}
|
||||||
12
build-logic/build.gradle.kts
Normal file
12
build-logic/build.gradle.kts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("com.github.johnrengelman:shadow:8.1.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
1
build-logic/settings.gradle.kts
Normal file
1
build-logic/settings.gradle.kts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "build-logic"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import org.gradle.kotlin.dsl.`java-library`
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
plugins {
|
||||||
|
`maven-publish` apply true
|
||||||
|
id("com.github.johnrengelman.shadow") apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
val repoName = if (version.toString().endsWith("SNAPSHOT")) "maven-snapshots" else "maven-releases"
|
||||||
|
maven("https://repo.opencollab.dev/${repoName}/") {
|
||||||
|
credentials.username = System.getenv("OPENCOLLAB_USERNAME")
|
||||||
|
credentials.password = System.getenv("OPENCOLLAB_PASSWORD")
|
||||||
|
name = "opencollab"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publications {
|
||||||
|
register("publish", MavenPublication::class) {
|
||||||
|
from(project.components["java"])
|
||||||
|
|
||||||
|
// skip shadow jar from publishing. Workaround for https://github.com/johnrengelman/shadow/issues/651
|
||||||
|
val javaComponent = project.components["java"] as AdhocComponentWithVariants
|
||||||
|
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { skip() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,57 +1,13 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("pack.base-conventions")
|
||||||
id("java-library")
|
|
||||||
id("maven-publish")
|
|
||||||
id("com.github.johnrengelman.shadow") version "7.1.0"
|
|
||||||
id("io.freefair.lombok") version "6.3.0" apply false
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
apply(plugin = "java")
|
|
||||||
apply(plugin = "java-library")
|
|
||||||
apply(plugin = "maven-publish")
|
|
||||||
apply(plugin = "com.github.johnrengelman.shadow")
|
|
||||||
apply(plugin = "io.freefair.lombok")
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
|
|
||||||
gradlePluginPortal()
|
|
||||||
|
|
||||||
// Geyser, Floodgate, Cumulus etc.
|
|
||||||
maven("https://repo.opencollab.dev/main")
|
|
||||||
maven("https://repo.opencollab.dev/maven-snapshots")
|
|
||||||
|
|
||||||
// Java pack library
|
|
||||||
maven("https://repo.unnamed.team/repository/unnamed-public/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subprojects{
|
||||||
|
plugins.apply("pack.base-conventions")
|
||||||
|
plugins.apply("pack.publish-conventions")
|
||||||
group = "org.geysermc.pack"
|
group = "org.geysermc.pack"
|
||||||
version = "3.0-SNAPSHOT"
|
version = "3.1-SNAPSHOT"
|
||||||
|
|
||||||
java.sourceCompatibility = JavaVersion.VERSION_17
|
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||||
java.targetCompatibility = JavaVersion.VERSION_17
|
java.targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
tasks.jar {
|
|
||||||
archiveClassifier.set("unshaded")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("build") {
|
|
||||||
dependsOn(tasks.shadowJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications.create<MavenPublication>("library") {
|
|
||||||
artifact(tasks.shadowJar)
|
|
||||||
}
|
|
||||||
val repoName = if (version.toString().endsWith("SNAPSHOT")) "maven-snapshots" else "maven-releases"
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.opencollab.dev/${repoName}/") {
|
|
||||||
credentials.username = System.getenv("OPENCOLLAB_USERNAME")
|
|
||||||
credentials.password = System.getenv("OPENCOLLAB_PASSWORD")
|
|
||||||
name = "opencollab"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,31 @@
|
|||||||
|
plugins {
|
||||||
|
id("io.freefair.lombok") version "8.6"
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
resources {
|
||||||
|
srcDir("src/main/java/resources")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":pack-schema-api"))
|
api(project(":pack-schema-api"))
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
implementation("commons-io:commons-io:2.11.0")
|
implementation("commons-io:commons-io:2.11.0")
|
||||||
implementation("com.twelvemonkeys.imageio:imageio-tga:3.9.4")
|
implementation("com.twelvemonkeys.imageio:imageio-tga:3.9.4")
|
||||||
implementation("com.nukkitx.fastutil:fastutil-int-object-maps:8.5.3")
|
implementation("com.nukkitx.fastutil:fastutil-int-object-maps:8.5.3")
|
||||||
implementation("net.kyori:adventure-api:4.14.0")
|
api("net.kyori:adventure-api:4.14.0")
|
||||||
implementation("net.kyori:adventure-text-serializer-gson:4.14.0")
|
api("net.kyori:adventure-text-serializer-gson:4.14.0")
|
||||||
implementation("net.kyori:adventure-text-serializer-legacy:4.14.0")
|
api("net.kyori:adventure-text-serializer-legacy:4.14.0")
|
||||||
implementation("team.unnamed:creative-api:1.7.0")
|
api("team.unnamed:creative-api:1.7.0")
|
||||||
implementation("team.unnamed:creative-serializer-minecraft:1.7.0")
|
api("team.unnamed:creative-serializer-minecraft:1.7.0")
|
||||||
|
|
||||||
compileOnly("com.google.auto.service:auto-service:1.0.1")
|
compileOnly("com.google.auto.service:auto-service:1.0.1")
|
||||||
annotationProcessor("com.google.auto.service:auto-service:1.0.1")
|
annotationProcessor("com.google.auto.service:auto-service:1.0.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
java {
|
||||||
from("src/main/java/resources") {
|
withSourcesJar()
|
||||||
include("*")
|
|
||||||
}
|
|
||||||
|
|
||||||
archiveFileName.set("PackConverter-lib.jar")
|
|
||||||
archiveClassifier.set("")
|
|
||||||
}
|
}
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
api(project(":bedrock-pack-schema"))
|
compileOnlyApi(project(":bedrock-pack-schema")) // Available on compile, but not runtime classpath - we shade it in task below
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
implementation("org.jetbrains:annotations:24.0.1")
|
implementation("org.jetbrains:annotations:24.0.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val bedrockPackSchemaSourceSet = project(":bedrock-pack-schema").sourceSets.getByName("main")
|
||||||
|
|
||||||
|
tasks.jar {
|
||||||
|
from(bedrockPackSchemaSourceSet.output)
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.WARN
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
rootProject.name = "packconverter-parent"
|
rootProject.name = "packconverter-parent"
|
||||||
|
|
||||||
include(":bootstrap")
|
include(":bootstrap")
|
||||||
@@ -10,3 +12,20 @@ include(":schema-generator")
|
|||||||
project(":pack-schema-api").projectDir = file("pack-schema/api")
|
project(":pack-schema-api").projectDir = file("pack-schema/api")
|
||||||
project(":bedrock-pack-schema").projectDir = file("pack-schema/bedrock")
|
project(":bedrock-pack-schema").projectDir = file("pack-schema/bedrock")
|
||||||
project(":schema-generator").projectDir = file("pack-schema/generator")
|
project(":schema-generator").projectDir = file("pack-schema/generator")
|
||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
includeBuild("build-logic")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
// Geyser, Floodgate, Cumulus etc.
|
||||||
|
maven("https://repo.opencollab.dev/main")
|
||||||
|
maven("https://repo.opencollab.dev/maven-snapshots")
|
||||||
|
|
||||||
|
// Java pack library
|
||||||
|
maven("https://repo.unnamed.team/repository/unnamed-public/")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user