-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting up remote publications to github packages and to maven central
- Loading branch information
Showing
6 changed files
with
105 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,15 @@ plugins { | |
id("com.adarshr.test-logger") | ||
id("org.jetbrains.dokka") | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
val androidEnabled = project.findProperty("android")?.toString()?.toBoolean() == true | ||
val release = project.findProperty("release")?.toString()?.toBoolean() == true | ||
val githubPublish = project.findProperty("githubPublish")?.toString()?.toBoolean() == true | ||
|
||
// If the publication is meant to be done on a remote repository (GitHub packages or Maven central). | ||
// Modifying this property will affect the release workflows! | ||
val isRemotePublication = project.findProperty("remotePublication")?.toString()?.toBoolean() == true | ||
|
||
var buildMode = if (release) BuildMode.RELEASE else BuildMode.DEBUG | ||
|
||
|
@@ -74,7 +78,7 @@ kotlin { | |
} | ||
} | ||
val jvmMain by getting { | ||
if (githubPublish) { | ||
if (isRemotePublication) { | ||
// The line below is intended to load the native libraries that are crosscompiled on GitHub actions when publishing a JVM package. | ||
resources.srcDir("../jni-libs").include("*/**") | ||
} else { | ||
|
@@ -89,7 +93,39 @@ kotlin { | |
|
||
publishing { | ||
publications.withType<MavenPublication> { | ||
groupId = "org.eclipse.zenoh" | ||
artifactId = "zenoh-java" | ||
version = project.version.toString() + if (project.hasProperty("SNAPSHOT")) "-SNAPSHOT" else "" | ||
|
||
pom { | ||
name.set("Zenoh Java") | ||
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("[email protected]") | ||
} | ||
developer { | ||
id.set("DariusIMP") | ||
name.set("Darius Maitia") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:https://github.com/eclipse-zenoh/zenoh-java.git") | ||
developerConnection.set("scm:git:https://github.com/eclipse-zenoh/zenoh-java.git") | ||
url.set("https://github.com/eclipse-zenoh/zenoh-java") | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
|
@@ -101,10 +137,32 @@ kotlin { | |
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") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
isRequired = isRemotePublication | ||
useInMemoryPgpKeys(System.getenv("ORG_GPG_SUBKEY_ID"), System.getenv("ORG_GPG_PRIVATE_KEY"), System.getenv("ORG_GPG_PASSPHRASE")) | ||
sign(publishing.publications) | ||
} | ||
|
||
tasks.withType<PublishToMavenRepository>().configureEach { | ||
dependsOn(tasks.withType<Sign>()) | ||
} | ||
|
||
tasks.withType<Test> { | ||
doFirst { | ||
// The line below is added for the Android Unit tests which are equivalent to the JVM tests. | ||
|
@@ -125,7 +183,7 @@ tasks.named("compileKotlinJvm") { | |
|
||
tasks.register("buildZenohJni") { | ||
doLast { | ||
if (!githubPublish) { | ||
if (!isRemotePublication) { | ||
// This is intended for local publications. For publications done through GitHub workflows, | ||
// the zenoh-jni build is achieved and loaded differently from the CI | ||
buildZenohJNI(buildMode) | ||
|