From be6bd21c2e30831559751103858dbbc02e0b28a9 Mon Sep 17 00:00:00 2001 From: Diogo Mendes Matsubara Date: Tue, 19 Nov 2024 12:49:23 +0100 Subject: [PATCH 1/4] chore: update kotlin to 1.9.20 To use the com.vanniktech.maven.publish plugin we need a newer version of kotlin --- build.gradle.kts | 4 ++-- zenoh-kotlin/build.gradle.kts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 44bd0f13..ec722918 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,8 +28,8 @@ buildscript { plugins { id("com.android.library") version "7.4.2" apply false - id("org.jetbrains.kotlin.android") version "1.9.10" apply false - id("org.jetbrains.kotlin.multiplatform") version "1.9.0" apply false + id("org.jetbrains.kotlin.android") version "1.9.20" apply false + id("org.jetbrains.kotlin.multiplatform") version "1.9.20" apply false id("org.mozilla.rust-android-gradle.rust-android") version "0.9.3" apply false id("org.jetbrains.dokka") version "1.8.20" apply false id("com.adarshr.test-logger") version "3.2.0" apply false diff --git a/zenoh-kotlin/build.gradle.kts b/zenoh-kotlin/build.gradle.kts index f1f9ef43..3ffe7248 100644 --- a/zenoh-kotlin/build.gradle.kts +++ b/zenoh-kotlin/build.gradle.kts @@ -19,8 +19,7 @@ plugins { kotlin("plugin.serialization") id("com.adarshr.test-logger") id("org.jetbrains.dokka") - `maven-publish` - signing + id("com.vanniktech.maven.publish") version "0.30.0" } val androidEnabled = project.findProperty("android")?.toString()?.toBoolean() == true From c95d77bb51f91294a4d5791297cd33fa644278b2 Mon Sep 17 00:00:00 2001 From: Diogo Mendes Matsubara Date: Tue, 19 Nov 2024 14:14:44 +0100 Subject: [PATCH 2/4] fix: use maven.publish plugin --- zenoh-kotlin/build.gradle.kts | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/zenoh-kotlin/build.gradle.kts b/zenoh-kotlin/build.gradle.kts index 3ffe7248..c85b62c3 100644 --- a/zenoh-kotlin/build.gradle.kts +++ b/zenoh-kotlin/build.gradle.kts @@ -149,33 +149,20 @@ kotlin { repositories { maven { - name = "GithubPackages" + name = "githubPackages" url = uri("https://maven.pkg.github.com/eclipse-zenoh/zenoh-kotlin") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - maven { - name = "MavenCentral" - url = uri(if (project.hasProperty("SNAPSHOT")) - "https://oss.sonatype.org/content/repositories/snapshots/" - else - "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - ) - credentials { - username = System.getenv("ORG_OSSRH_USERNAME") - password = System.getenv("ORG_OSSRH_PASSWORD") - } + // username and password (a personal Github access token) should be specified as + // `githubPackagesUsername` and `githubPackagesPassword` Gradle properties or alternatively + // as `ORG_GRADLE_PROJECT_githubPackagesUsername` and `ORG_GRADLE_PROJECT_githubPackagesPassword` + // environment variables + credentials(PasswordCredentials::class) } } } -} -signing { - isRequired = isRemotePublication - useInMemoryPgpKeys(System.getenv("ORG_GPG_SUBKEY_ID"), System.getenv("ORG_GPG_PRIVATE_KEY"), System.getenv("ORG_GPG_PASSPHRASE")) - sign(publishing.publications) + publishToMavenCentral() + + signAllPublications() } tasks.withType().configureEach { From 929adabdd70befca5dfaf3325b584ef9c86eb78e Mon Sep 17 00:00:00 2001 From: Diogo Mendes Matsubara Date: Tue, 19 Nov 2024 14:20:33 +0100 Subject: [PATCH 3/4] fix: update release workflow env vars --- .github/workflows/publish-android.yml | 20 ++++++++++---------- .github/workflows/publish-jvm.yml | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index 3e5956bc..52f1a33e 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -84,17 +84,17 @@ jobs: run: ./gradlew publishAndroidReleasePublicationToGithubPackagesRepository -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }} ${{ env.DEBUG }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ORG_GPG_KEY_ID: ${{ secrets.ORG_GPG_KEY_ID }} - ORG_GPG_SUBKEY_ID: ${{ secrets.ORG_GPG_SUBKEY_ID }} - ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }} - ORG_GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} + ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ env.GITHUB_ACTOR }} + ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GPG_SUBKEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GPG_PASSPHRASE }} - name: Gradle Publish Android Package to Maven Central repository run: ./gradlew publishAndroidReleasePublicationToMavenCentralRepository -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }} ${{ env.DEBUG }} env: - ORG_OSSRH_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }} - ORG_OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} - ORG_GPG_KEY_ID: ${{ secrets.ORG_GPG_KEY_ID }} - ORG_GPG_SUBKEY_ID: ${{ secrets.ORG_GPG_SUBKEY_ID }} - ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }} - ORG_GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GPG_SUBKEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GPG_PASSPHRASE }} \ No newline at end of file diff --git a/.github/workflows/publish-jvm.yml b/.github/workflows/publish-jvm.yml index 531d0fa6..1d959261 100644 --- a/.github/workflows/publish-jvm.yml +++ b/.github/workflows/publish-jvm.yml @@ -189,18 +189,18 @@ jobs: run: ./gradlew publishJvmPublicationToGithubPackagesRepository -PremotePublication=true ${{ env.PUB_MODE }} ${{ env.DEBUG }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ORG_GPG_KEY_ID: ${{ secrets.ORG_GPG_KEY_ID }} - ORG_GPG_SUBKEY_ID: ${{ secrets.ORG_GPG_SUBKEY_ID }} - ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }} - ORG_GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} + ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ env.GITHUB_ACTOR }} + ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GPG_SUBKEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GPG_PASSPHRASE }} - name: Gradle Publish JVM Package to Maven Central repository run: ./gradlew publishJvmPublicationToMavenCentralRepository -PremotePublication=true ${{ env.PUB_MODE }} ${{ env.DEBUG }} env: - ORG_OSSRH_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }} - ORG_OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} - ORG_GPG_KEY_ID: ${{ secrets.ORG_GPG_KEY_ID }} - ORG_GPG_SUBKEY_ID: ${{ secrets.ORG_GPG_SUBKEY_ID }} - ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }} - ORG_GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GPG_SUBKEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GPG_PASSPHRASE }} \ No newline at end of file From 9800ff7bfbac88166f09c5f7d42c18c9a9c1d5a3 Mon Sep 17 00:00:00 2001 From: Diogo Mendes Matsubara Date: Tue, 19 Nov 2024 16:25:50 +0100 Subject: [PATCH 4/4] fix: use mavenPublishing like in the example --- zenoh-kotlin/build.gradle.kts | 106 ++++++++++++++++------------------ 1 file changed, 50 insertions(+), 56 deletions(-) diff --git a/zenoh-kotlin/build.gradle.kts b/zenoh-kotlin/build.gradle.kts index c85b62c3..46d6c2f7 100644 --- a/zenoh-kotlin/build.gradle.kts +++ b/zenoh-kotlin/build.gradle.kts @@ -95,74 +95,68 @@ kotlin { } } - publishing { - publications.withType { - groupId = "io.zenoh" - artifactId = "zenoh-kotlin" - version = project.version.toString() + if (project.hasProperty("SNAPSHOT")) "-SNAPSHOT" else "" - - pom { - name.set("Zenoh Kotlin") - description.set("The Eclipse Zenoh: Zero Overhead Pub/sub, Store/Query and Compute.") - url.set("https://zenoh.io/") - - licenses { - license { - name.set("Eclipse Public License 2.0 OR Apache License 2.0") - url.set("http://www.eclipse.org/legal/epl-2.0") - } + mavenPublishing { + pom { + name.set("Zenoh Kotlin") + description.set("The Eclipse Zenoh: Zero Overhead Pub/sub, Store/Query and Compute.") + url.set("https://zenoh.io/") + + licenses { + license { + name.set("Eclipse Public License 2.0 OR Apache License 2.0") + url.set("http://www.eclipse.org/legal/epl-2.0") } - developers { - developer { - id.set("ZettaScale") - name.set("ZettaScale Zenoh Team") - email.set("zenoh@zettascale.tech") - } - developer { - id.set("DariusIMP") - name.set("Darius Maitia") - email.set("darius@zettascale.tech") - } - developer { - id.set("Mallets") - name.set("Luca Cominardi") - email.set("luca@zettascale.tech") - } - developer { - id.set("Kydos") - name.set("Angelo Corsaro") - email.set("angelo@zettascale.tech") - } - developer { - id.set("Wyfo") - name.set("Joseph Perez") - email.set("joseph.perez@zettascale.tech") - } + } + developers { + developer { + id.set("ZettaScale") + name.set("ZettaScale Zenoh Team") + email.set("zenoh@zettascale.tech") + } + developer { + id.set("DariusIMP") + name.set("Darius Maitia") + email.set("darius@zettascale.tech") + } + developer { + id.set("Mallets") + name.set("Luca Cominardi") + email.set("luca@zettascale.tech") + } + developer { + id.set("Kydos") + name.set("Angelo Corsaro") + email.set("angelo@zettascale.tech") } - scm { - connection.set("scm:git:https://github.com/eclipse-zenoh/zenoh-kotlin.git") - developerConnection.set("scm:git:https://github.com/eclipse-zenoh/zenoh-kotlin.git") - url.set("https://github.com/eclipse-zenoh/zenoh-kotlin") + developer { + id.set("Wyfo") + name.set("Joseph Perez") + email.set("joseph.perez@zettascale.tech") } } + scm { + connection.set("scm:git:https://github.com/eclipse-zenoh/zenoh-kotlin.git") + developerConnection.set("scm:git:https://github.com/eclipse-zenoh/zenoh-kotlin.git") + url.set("https://github.com/eclipse-zenoh/zenoh-kotlin") + } } - repositories { - maven { - name = "githubPackages" - url = uri("https://maven.pkg.github.com/eclipse-zenoh/zenoh-kotlin") - // username and password (a personal Github access token) should be specified as - // `githubPackagesUsername` and `githubPackagesPassword` Gradle properties or alternatively - // as `ORG_GRADLE_PROJECT_githubPackagesUsername` and `ORG_GRADLE_PROJECT_githubPackagesPassword` - // environment variables - credentials(PasswordCredentials::class) - } + repositories { + maven { + name = "githubPackages" + url = uri("https://maven.pkg.github.com/eclipse-zenoh/zenoh-kotlin") + // username and password (a personal Github access token) should be specified as + // `githubPackagesUsername` and `githubPackagesPassword` Gradle properties or alternatively + // as `ORG_GRADLE_PROJECT_githubPackagesUsername` and `ORG_GRADLE_PROJECT_githubPackagesPassword` + // environment variables + credentials(PasswordCredentials::class) } } publishToMavenCentral() signAllPublications() + } } tasks.withType().configureEach {