From 291f157dd43ad073ad280331567f6305c4867159 Mon Sep 17 00:00:00 2001 From: Luca Spinazzola Date: Thu, 15 Feb 2024 01:10:50 -0500 Subject: [PATCH] properly apply vanniktech maven publish plugin --- build.gradle.kts | 55 ++---------------------------------- gradle.properties | 5 +++- kamel-core/build.gradle.kts | 10 +------ kamel-image/build.gradle.kts | 11 +------- 4 files changed, 8 insertions(+), 73 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 53a6f333..58cdb830 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,5 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import java.util.* plugins { alias(libs.plugins.org.jetbrains.kotlin.multiplatform) apply false @@ -10,48 +9,17 @@ plugins { alias(libs.plugins.com.vanniktech.maven.publish) apply false } -val file = project.file("local.properties") - -if (file.exists()) { - Properties().apply { - val inputStream = file.inputStream() - load(inputStream) - ext { - set("signing.keyId", getProperty("signing.keyId")) - set("signing.password", getProperty("signing.password")) - set("ossrh.username", getProperty("ossrh.username")) - set("ossrh.password", getProperty("ossrh.password")) - set("signing.secretKeyRingFile", getProperty("signing.secretKeyRingFile")) - set("stagingProfileId", getProperty("stagingProfileId")) - } - inputStream.close() - } -} else { - ext { - set("signing.keyId", System.getenv("SIGNING_KEY_ID")) - set("signing.password", System.getenv("SIGNING_PASSWORD")) - set("ossrh.username", System.getenv("OSSRH_USERNAME")) - set("ossrh.password", System.getenv("OSSRH_PASSWORD")) - set("signing.secretKeyRingFile", System.getenv("SIGNING_SECRET_KEY_RING_FILE")) - set("stagingProfileId", System.getenv("STAGING_PROFILE_ID")) - } -} allprojects { group = project.property("GROUP") as String version = project.property("VERSION_NAME") as String - val emptyJavadocJar by tasks.registering(Jar::class) { - archiveClassifier.set("javadoc") - } afterEvaluate { extensions.findByType()?.apply { publications.withType().configureEach { - artifact(emptyJavadocJar.get()) - pom { name.set("Kamel") @@ -61,7 +29,7 @@ allprojects { licenses { license { name.set("The Apache Software License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") distribution.set("repo") } } @@ -79,7 +47,7 @@ allprojects { scm { connection.set("scm:git:github.com/Kamel-Media/Kamel.git") - developerConnection.set("scm:git:ssh://github.com/alialbaali/Kamel.git") + developerConnection.set("scm:git:ssh://github.com/Kamel-Media/Kamel.git") url.set("https://github.com/Kamel-Media/Kamel/tree/main") } @@ -87,25 +55,6 @@ allprojects { } - repositories { - maven { - - name = "MavenCentral" - - val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" - - url = if (version.toString().endsWith("SNAPSHOT")) uri(snapshotsRepoUrl) else uri(releasesRepoUrl) - - credentials { - username = rootProject.ext["ossrh.username"] as String? ?: "" - password = rootProject.ext["ossrh.password"] as String? ?: "" - } - - } - } - - extensions.findByType()?.sign(publications) } } diff --git a/gradle.properties b/gradle.properties index d3e6dcd5..03fcb098 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,4 +13,7 @@ org.jetbrains.compose.experimental.macos.enabled=true org.jetbrains.compose.experimental.uikit.enabled=true GROUP=media.kamel -VERSION_NAME=0.9.2 \ No newline at end of file +VERSION_NAME=0.9.2 + +SONATYPE_HOST=S01 +RELEASE_SIGNING_ENABLED=true \ No newline at end of file diff --git a/kamel-core/build.gradle.kts b/kamel-core/build.gradle.kts index 2b7a3306..50b8cb2b 100644 --- a/kamel-core/build.gradle.kts +++ b/kamel-core/build.gradle.kts @@ -3,9 +3,8 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode plugins { alias(libs.plugins.org.jetbrains.kotlin.multiplatform) alias(libs.plugins.org.jetbrains.compose) - `maven-publish` - signing alias(libs.plugins.com.android.library) + alias(libs.plugins.com.vanniktech.maven.publish) } kotlin { @@ -106,13 +105,6 @@ kotlin { } } -// https://youtrack.jetbrains.com/issue/KT-46466 -val dependsOnTasks = mutableListOf() -tasks.withType().configureEach { - dependsOnTasks.add(this.name.replace("publish", "sign").replaceAfter("Publication", "")) - dependsOn(dependsOnTasks) -} - android { namespace = "io.kamel.core.cache" compileSdk = 34 diff --git a/kamel-image/build.gradle.kts b/kamel-image/build.gradle.kts index 3e8b243b..835c2f2b 100644 --- a/kamel-image/build.gradle.kts +++ b/kamel-image/build.gradle.kts @@ -4,8 +4,7 @@ plugins { alias(libs.plugins.org.jetbrains.kotlin.multiplatform) alias(libs.plugins.org.jetbrains.compose) alias(libs.plugins.com.android.library) - `maven-publish` - signing + alias(libs.plugins.com.vanniktech.maven.publish) } android { @@ -141,11 +140,3 @@ kotlin { } } - -// https://youtrack.jetbrains.com/issue/KT-46466 -val dependsOnTasks = mutableListOf() -tasks.withType().configureEach { - dependsOnTasks.add(this.name.replace("publish", "sign").replaceAfter("Publication", "")) - dependsOn(dependsOnTasks) -} -