diff --git a/build-logic/src/main/kotlin/extensions.kt b/build-logic/src/main/kotlin/extensions.kt index 342d7107..0b0b7dee 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.JavaVersion 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.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 { val byteOut = ByteArrayOutputStream() exec { diff --git a/build-logic/src/main/kotlin/vb.base-conventions.gradle.kts b/build-logic/src/main/kotlin/vb.base-conventions.gradle.kts index 10801d73..377b40a1 100644 --- a/build-logic/src/main/kotlin/vb.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/vb.base-conventions.gradle.kts @@ -1,6 +1,5 @@ plugins { `java-library` - `maven-publish` } tasks { @@ -23,20 +22,4 @@ tasks { 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") - } - } -} +} \ No newline at end of file diff --git a/build-logic/src/main/kotlin/vb.shadow-conventions.gradle.kts b/build-logic/src/main/kotlin/vb.shadow-conventions.gradle.kts index 77795eee..97f1425c 100644 --- a/build-logic/src/main/kotlin/vb.shadow-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/vb.shadow-conventions.gradle.kts @@ -4,6 +4,7 @@ import org.gradle.kotlin.dsl.named plugins { id("vb.base-conventions") + id("maven-publish") id("com.github.johnrengelman.shadow") } @@ -21,7 +22,24 @@ tasks { } } -publishShadowJar() +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") diff --git a/build-logic/src/main/kotlin/vb.standard-conventions.gradle.kts b/build-logic/src/main/kotlin/vb.standard-conventions.gradle.kts deleted file mode 100644 index b93b396d..00000000 --- a/build-logic/src/main/kotlin/vb.standard-conventions.gradle.kts +++ /dev/null @@ -1,5 +0,0 @@ -plugins { - id("vb.base-conventions") -} - -publishJavaComponents() diff --git a/build.gradle.kts b/build.gradle.kts index b3dc0d94..b40ecff9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,6 +20,6 @@ val main = setOf( subprojects { when (this) { in main -> plugins.apply("vb.shadow-conventions") - else -> plugins.apply("vb.standard-conventions") + else -> plugins.apply("vb.base-conventions") } }