From 337ac3d5304eb2c20ee96d90772f67d501bf0636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20Demirta=C5=9F?= Date: Sun, 9 Jun 2024 14:56:00 +0300 Subject: [PATCH] Update build.gradle.kts (#11) * Update build.gradle.kts * simplify. * simplify. --- build.gradle.kts | 22 +++++++++++++++++----- kotlin/extensions/build.gradle.kts | 6 ------ kotlin/protobuf/build.gradle.kts | 6 ------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f4b28c7..6e33a6c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ +import com.vanniktech.maven.publish.MavenPublishBaseExtension import com.vanniktech.maven.publish.MavenPublishPlugin import com.vanniktech.maven.publish.SonatypeHost import org.jetbrains.dokka.gradle.DokkaPlugin plugins { java - `maven-publish` - alias(libs.plugins.nexus) + alias(libs.plugins.nexus) apply false alias(libs.plugins.kotlin) apply false alias(libs.plugins.dokka) apply false } @@ -26,14 +26,26 @@ subprojects { toolchain { languageVersion = JavaLanguageVersion.of(8) } - withJavadocJar() - withSourcesJar() + } + + tasks { + val javadocJar by creating(Jar::class) { + dependsOn("javadoc") + archiveClassifier.set("javadoc") + from(javadoc) + } + + val sourcesJar by creating(Jar::class) { + dependsOn("classes") + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) + } } val projectName = project.property("artifact-id") as String val signRequired = project.hasProperty("sign-required") - mavenPublishing { + extensions.configure { coordinates(project.group.toString(), projectName, project.version.toString()) publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) if (signRequired) { diff --git a/kotlin/extensions/build.gradle.kts b/kotlin/extensions/build.gradle.kts index b1a1e8a..0a5d986 100644 --- a/kotlin/extensions/build.gradle.kts +++ b/kotlin/extensions/build.gradle.kts @@ -1,9 +1,3 @@ dependencies { compileOnly(project(":common")) } - -tasks { - javadocJar { - from(dokkaJavadoc.map { it.outputs }) - } -} diff --git a/kotlin/protobuf/build.gradle.kts b/kotlin/protobuf/build.gradle.kts index 9069fbe..ec909e7 100644 --- a/kotlin/protobuf/build.gradle.kts +++ b/kotlin/protobuf/build.gradle.kts @@ -9,9 +9,3 @@ dependencies { compileOnly(libs.kotlinx.serialization.core) compileOnly(libs.kotlinx.serialization.protobuf) } - -tasks { - javadocJar { - from(dokkaJavadoc.map { it.outputs }) - } -}