Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13]
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4
Expand Down
29 changes: 17 additions & 12 deletions .github/workflows/publish-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on:
description: Target branch
type: string
required: false
workflow_dispatch:
maven_publish:
type: boolean
required: false
default: true

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -68,23 +71,25 @@ jobs:
run: |
if [[ "${{ inputs.snapshot }}" == "true" ]]; then
echo "PUB_MODE=-PSNAPSHOT" >> $GITHUB_ENV
else
echo "RELEASE=closeAndReleaseSonatypeStagingRepository" >> $GITHUB_ENV
fi

- name: Gradle Publish Android Package to GitHub packages repository
run: ./gradlew publishAndroidReleasePublicationToGithubPackagesRepository -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }}
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 }}

- name: Gradle Publish Android Package to Maven Central repository
run: ./gradlew publishAndroidReleasePublicationToMavenCentralRepository -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }}
- if: ${{ inputs.maven_publish == true }}
name: Gradle Publish Android Package to Maven Central repository
run: |
./gradlew publishAndroidReleasePublicationToSonatypeRepository ${{ env.RELEASE }} --info -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }}
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 }}

- name: "Upload gradle problems report"
if: always()
uses: actions/upload-artifact@v4
with:
name: problem-reports-${{ github.job }}.zip
path: ${{ github.workspace }}/build/reports/problems/
2 changes: 1 addition & 1 deletion .github/workflows/publish-dokka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
ref: ${{ inputs.branch }}

- name: Build doc
run: gradle dokkaJavadoc
run: gradle dokkaGenerate

- name: Deploy doc
if: ${{ inputs.live-run || false }}
Expand Down
32 changes: 18 additions & 14 deletions .github/workflows/publish-jvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on:
description: Target branch
type: string
required: false
workflow_dispatch:
maven_publish:
type: boolean
required: false
default: true

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -74,7 +77,7 @@ jobs:
shell: bash
run: |
case ${{ matrix.job.target }} in
*-linux-gnu*) cargo +stable install cargo-deb --locked;;
*-linux-gnu*) cargo +stable install cargo-deb --locked ;;
esac

case ${{ matrix.job.target }} in
Expand Down Expand Up @@ -173,24 +176,25 @@ jobs:
run: |
if [[ "${{ inputs.snapshot }}" == "true" ]]; then
echo "PUB_MODE=-PSNAPSHOT" >> $GITHUB_ENV
else
echo "RELEASE=closeAndReleaseSonatypeStagingRepository" >> $GITHUB_ENV
fi

- name: Gradle Publish JVM Package to GitHub packages repository
run: ./gradlew publishJvmPublicationToGithubPackagesRepository -PremotePublication=true ${{ env.PUB_MODE }}
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 }}


- name: Gradle Publish JVM Package to Maven Central repository
run: ./gradlew publishJvmPublicationToMavenCentralRepository -PremotePublication=true ${{ env.PUB_MODE }}
- if: ${{ inputs.maven_publish == true }}
name: Gradle Publish JVM Package to Maven Central repository
run: |
./gradlew publishJvmPublicationToSonatypeRepository ${{ env.RELEASE }} --info -PremotePublication=true ${{ env.PUB_MODE }}
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 }}

- name: "Upload gradle problems report"
if: always()
uses: actions/upload-artifact@v4
with:
name: problem-reports-${{ github.job }}.zip
path: ${{ github.workspace }}/build/reports/problems/
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ on:
type: string
description: Release branch
required: false
maven_publish:
type: boolean
description: Publish the package to Maven Central
required: false

jobs:
tag:
Expand Down Expand Up @@ -75,6 +79,7 @@ jobs:
with:
snapshot: ${{ !(inputs.live-run || false) }}
branch: ${{ needs.tag.outputs.branch }}
maven_publish: ${{ !(inputs.maven_publish || true )}}
permissions:
contents: read
packages: write
Expand All @@ -87,21 +92,22 @@ jobs:
with:
snapshot: ${{ !(inputs.live-run || false) }}
branch: ${{ needs.tag.outputs.branch }}
maven_publish: ${{ !(inputs.maven_publish || true )}}
permissions:
contents: read
packages: write
secrets: inherit

publish-dokka:
name: Publish documentation
needs: tag
needs: [tag, publish-android, publish-jvm]
uses: ./.github/workflows/publish-dokka.yml
with:
live-run: ${{ inputs.live-run || false }}
branch: ${{ needs.tag.outputs.branch }}

publish-github:
needs: tag
needs: [tag, publish-android, publish-jvm]
runs-on: macos-latest
steps:
- uses: eclipse-zenoh/ci/publish-crates-github@main
Expand Down
30 changes: 23 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//

val zenohGroup = "io.zenoh"
val zenohVersion = file("version.txt").readText()

buildscript {
repositories {
google()
Expand All @@ -32,15 +29,34 @@ plugins {
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
id("org.jetbrains.kotlin.multiplatform") version "1.9.0" apply false
id("org.mozilla.rust-android-gradle.rust-android") version "0.9.6" apply false
id("org.jetbrains.dokka") version "1.9.10" apply false
id("org.jetbrains.dokka-javadoc") version "2.0.0" apply false
id("com.adarshr.test-logger") version "3.2.0" apply false
kotlin("plugin.serialization") version "1.9.0" apply false
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}

subprojects {
group = zenohGroup
version = zenohVersion
group = "org.eclipse.zenoh"

val baseVersion = file("version.txt").readText().trim()
version = if (project.hasProperty("SNAPSHOT")) {
"$baseVersion-SNAPSHOT"
} else {
baseVersion
}

nexusPublishing {
repositories {
sonatype {
nexusUrl = uri("https://oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")

username = System.getenv("ORG_OSSRH_USERNAME")
password = System.getenv("ORG_OSSRH_PASSWORD")
}
}
}

subprojects {
repositories {
google()
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ tasks {

tasks.register("CompileZenohJNI") {
project.exec {
commandLine("cargo", "build", "--release", "--manifest-path", "./zenoh-jni/Cargo.toml")
commandLine("cargo", "build", "--release", "--manifest-path", "../zenoh-jni/Cargo.toml")
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
39 changes: 12 additions & 27 deletions zenoh-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
id("com.adarshr.test-logger")
id("org.jetbrains.dokka")
id("org.jetbrains.dokka-javadoc")
`maven-publish`
signing
}

val androidEnabled = project.findProperty("android")?.toString()?.toBoolean() == true
val release = project.findProperty("release")?.toString()?.toBoolean() == true

// If the publication is meant to be done on a remote repository (GitHub packages or Maven central).
// If the publication is meant to be done on a remote repository (Maven central).
// Modifying this property will affect the release workflows!
val isRemotePublication = project.findProperty("remotePublication")?.toString()?.toBoolean() == true

Expand Down Expand Up @@ -96,11 +96,19 @@ kotlin {
}
}

val javadocJar by tasks.registering(Jar::class) {
dependsOn("dokkaGenerate")
archiveClassifier.set("javadoc")
from("${buildDir}/dokka/html")
}

publishing {
publications.withType<MavenPublication> {
groupId = "org.eclipse.zenoh"
artifactId = "zenoh-java"
version = project.version.toString() + if (project.hasProperty("SNAPSHOT")) "-SNAPSHOT" else ""
version = rootProject.version.toString()

artifact(javadocJar)

pom {
name.set("Zenoh Java")
Expand Down Expand Up @@ -132,29 +140,6 @@ kotlin {
}
}
}

repositories {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/eclipse-zenoh/zenoh-java")
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")
}
}
}
}
}

Expand Down Expand Up @@ -204,7 +189,7 @@ fun buildZenohJNI(mode: BuildMode = BuildMode.DEBUG) {
}

val result = project.exec {
commandLine(*(cargoCommand.toTypedArray()), "--manifest-path", "./zenoh-jni/Cargo.toml")
commandLine(*(cargoCommand.toTypedArray()), "--manifest-path", "../zenoh-jni/Cargo.toml")
}

if (result.exitValue != 0) {
Expand Down