From b6bee8f4cc1b51c00760d5e6b213222385059d41 Mon Sep 17 00:00:00 2001 From: jmp Date: Thu, 18 Feb 2021 16:33:32 -0800 Subject: [PATCH] Configure artifacts for publication --- build.gradle.kts | 6 ++++++ buildSrc/src/main/kotlin/extensions.kt | 9 +++++++-- settings.gradle.kts | 5 ++++- universal/build.gradle.kts | 17 +++++++++++++---- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c3618917d..786fb8138 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -68,6 +68,12 @@ subprojects { } mitLicense() } + + publishing.repositories.maven { + name = "Via" + url = uri("https://repo.viaversion.com/") + credentials(PasswordCredentials::class) + } } tasks { diff --git a/buildSrc/src/main/kotlin/extensions.kt b/buildSrc/src/main/kotlin/extensions.kt index b7dd3c945..7399446ad 100644 --- a/buildSrc/src/main/kotlin/extensions.kt +++ b/buildSrc/src/main/kotlin/extensions.kt @@ -1,6 +1,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin import org.gradle.api.Project +import org.gradle.jvm.tasks.Jar import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.invoke import org.gradle.kotlin.dsl.withType @@ -10,16 +11,20 @@ fun Project.configureShadowJar() { apply() tasks { withType { - archiveClassifier.set("jar") + archiveClassifier.set("") archiveFileName.set("ViaVersion-${project.name.substringAfter("viaversion-").capitalize()}-${project.version}.jar") destinationDirectory.set(rootProject.projectDir.resolve("build/libs")) - //minimize() // ? configureRelocations() configureExcludes() } getByName("build") { dependsOn(withType()) } + withType { + if (name == "jar") { + archiveClassifier.set("unshaded") + } + } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index b7bbb3a32..8dc8a7043 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,7 +8,10 @@ setupViaSubproject("velocity") setupViaSubproject("sponge") setupViaSubproject("sponge-legacy") setupViaSubproject("fabric") -setupViaSubproject("universal") + +setupSubproject("viaversion") { + projectDir = file("universal") +} fun setupViaSubproject(name: String) { setupSubproject("viaversion-$name") { diff --git a/universal/build.gradle.kts b/universal/build.gradle.kts index aa49a70e6..c55fa450f 100644 --- a/universal/build.gradle.kts +++ b/universal/build.gradle.kts @@ -1,7 +1,11 @@ +import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +apply() + tasks { - val universalJar = register("universalJar") { - artifacts.add("archives", this) - archiveClassifier.set("jar") + withType { + archiveClassifier.set("") archiveFileName.set("ViaVersion-${project.version}.jar") destinationDirectory.set(rootProject.projectDir.resolve("build/libs")) duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -19,6 +23,11 @@ tasks { } } build { - dependsOn(universalJar) + dependsOn(withType()) + } + withType { + if (name == "jar") { + archiveClassifier.set("unshaded") + } } }