From 3f72e9ea47ed808a72426e5091dda065be66e788 Mon Sep 17 00:00:00 2001 From: EnZaXD Date: Mon, 3 Jun 2024 15:22:59 +0200 Subject: [PATCH] Don't publish extra modules (#3901) --- api/build.gradle.kts | 2 -- build-logic/src/main/kotlin/extensions.kt | 26 ------------------- .../kotlin/via.base-conventions.gradle.kts | 17 ------------ .../kotlin/via.shadow-conventions.gradle.kts | 20 ++++++++++++++ .../via.standard-conventions.gradle.kts | 5 ---- build.gradle.kts | 5 +--- bukkit/build.gradle.kts | 2 -- common/build.gradle.kts | 2 -- universal/build.gradle.kts | 2 -- velocity/build.gradle.kts | 2 -- 10 files changed, 21 insertions(+), 62 deletions(-) delete mode 100644 build-logic/src/main/kotlin/via.standard-conventions.gradle.kts diff --git a/api/build.gradle.kts b/api/build.gradle.kts index f8a297ac5..065145c8c 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -34,5 +34,3 @@ dependencies { java { withJavadocJar() } - -publishShadowJar() diff --git a/build-logic/src/main/kotlin/extensions.kt b/build-logic/src/main/kotlin/extensions.kt index e018c4abf..83828ac32 100644 --- a/build-logic/src/main/kotlin/extensions.kt +++ b/build-logic/src/main/kotlin/extensions.kt @@ -1,34 +1,8 @@ import org.gradle.api.Project import org.gradle.api.plugins.JavaPluginExtension -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPublication import org.gradle.jvm.toolchain.JavaLanguageVersion -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.get -import org.gradle.kotlin.dsl.named import java.io.ByteArrayOutputStream -fun Project.publishShadowJar() { - configurePublication { - artifact(tasks["shadowJar"]) - artifact(tasks["sourcesJar"]) - } -} - -fun Project.publishJavaComponents() { - configurePublication { - from(components["java"]) - } -} - -private fun Project.configurePublication(configurer: MavenPublication.() -> Unit) { - extensions.configure { - publications.named("mavenJava") { - apply(configurer) - } - } -} - fun Project.latestCommitHash(): String { return runGitCommand(listOf("rev-parse", "--short", "HEAD")) } diff --git a/build-logic/src/main/kotlin/via.base-conventions.gradle.kts b/build-logic/src/main/kotlin/via.base-conventions.gradle.kts index c08779bc4..c67bf7a5a 100644 --- a/build-logic/src/main/kotlin/via.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/via.base-conventions.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `maven-publish` } tasks { @@ -27,19 +26,3 @@ java { javaTarget(17) withSourcesJar() } - -publishing { - publications.create("mavenJava") { - groupId = rootProject.group as String - artifactId = project.name - version = rootProject.version as String - } - repositories.maven { - name = "Via" - url = uri("https://repo.viaversion.com/") - credentials(PasswordCredentials::class) - authentication { - create("basic") - } - } -} diff --git a/build-logic/src/main/kotlin/via.shadow-conventions.gradle.kts b/build-logic/src/main/kotlin/via.shadow-conventions.gradle.kts index dcd2212e4..fe4b82796 100644 --- a/build-logic/src/main/kotlin/via.shadow-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/via.shadow-conventions.gradle.kts @@ -3,6 +3,7 @@ import org.gradle.jvm.tasks.Jar plugins { id("via.base-conventions") + id("maven-publish") id("com.github.johnrengelman.shadow") } @@ -21,6 +22,25 @@ tasks { } } +publishing { + publications.create("mavenJava") { + groupId = rootProject.group as String + artifactId = project.name + version = rootProject.version as String + + artifact(tasks["shadowJar"]) + artifact(tasks["sourcesJar"]) + } + repositories.maven { + name = "Via" + url = uri("https://repo.viaversion.com/") + credentials(PasswordCredentials::class) + authentication { + create("basic") + } + } +} + fun ShadowJar.configureRelocations() { relocate("com.google.gson", "com.viaversion.viaversion.libs.gson") relocate("it.unimi.dsi.fastutil", "com.viaversion.viaversion.libs.fastutil") diff --git a/build-logic/src/main/kotlin/via.standard-conventions.gradle.kts b/build-logic/src/main/kotlin/via.standard-conventions.gradle.kts deleted file mode 100644 index 519de9f7a..000000000 --- a/build-logic/src/main/kotlin/via.standard-conventions.gradle.kts +++ /dev/null @@ -1,5 +0,0 @@ -plugins { - id("via.base-conventions") -} - -publishJavaComponents() diff --git a/build.gradle.kts b/build.gradle.kts index 5c7ba5223..570e7b82e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,12 +18,9 @@ val main = setOf( projects.viaversionFabric ).map { it.dependencyProject } -// val special = setOf().map { it.dependencyProject } - subprojects { when (this) { in main -> plugins.apply("via.shadow-conventions") - // in special -> plugins.apply("via.base-conventions") - else -> plugins.apply("via.standard-conventions") + else -> plugins.apply("via.base-conventions") } } diff --git a/bukkit/build.gradle.kts b/bukkit/build.gradle.kts index 7146ad140..96b38d1bd 100644 --- a/bukkit/build.gradle.kts +++ b/bukkit/build.gradle.kts @@ -7,5 +7,3 @@ dependencies { exclude("javax.persistence", "persistence-api") } } - -publishShadowJar() diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 911d93cc3..785bdbd5f 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -20,5 +20,3 @@ java { tasks.named("sourcesJar") { from(project(":viaversion-api").sourceSets.main.get().allSource) } - -publishShadowJar() \ No newline at end of file diff --git a/universal/build.gradle.kts b/universal/build.gradle.kts index f760da535..55f32d3ab 100644 --- a/universal/build.gradle.kts +++ b/universal/build.gradle.kts @@ -30,8 +30,6 @@ tasks { } } -publishShadowJar() - val branch = rootProject.branchName() val baseVersion = project.version as String val isRelease = !baseVersion.contains('-') diff --git a/velocity/build.gradle.kts b/velocity/build.gradle.kts index 4c60a4d33..9e2119fe0 100644 --- a/velocity/build.gradle.kts +++ b/velocity/build.gradle.kts @@ -6,5 +6,3 @@ dependencies { } annotationProcessor(libs.velocity) } - -publishShadowJar()