From 2ab599a447277a38c938953e6bf49a80835f8c2b Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Wed, 9 Oct 2024 16:37:13 -0300 Subject: [PATCH] - Added missing signing config required to publish - Sources and Javadoc must be included in all artifacts --- .../gradle/PublishConfigPlugin.groovy | 32 +++++++++++++++---- .../conductor-client-spring/build.gradle | 7 +++- .../orkes-spring/build.gradle | 7 +++- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/conductor-clients/java/conductor-java-sdk/buildSrc/src/main/groovy/io/orkes/conductor/gradle/PublishConfigPlugin.groovy b/conductor-clients/java/conductor-java-sdk/buildSrc/src/main/groovy/io/orkes/conductor/gradle/PublishConfigPlugin.groovy index 6e1f0575d..a71b9418e 100644 --- a/conductor-clients/java/conductor-java-sdk/buildSrc/src/main/groovy/io/orkes/conductor/gradle/PublishConfigPlugin.groovy +++ b/conductor-clients/java/conductor-java-sdk/buildSrc/src/main/groovy/io/orkes/conductor/gradle/PublishConfigPlugin.groovy @@ -3,6 +3,7 @@ package io.orkes.conductor.gradle import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.publish.maven.plugins.MavenPublishPlugin +import org.gradle.plugins.signing.SigningPlugin import org.gradle.api.publish.maven.MavenPublication import org.gradle.authentication.aws.AwsImAuthentication @@ -11,18 +12,35 @@ class PublishConfigPlugin implements Plugin { @Override void apply(Project project) { project.plugins.withType(MavenPublishPlugin) { - config(project) + publishingConfig(project) + } + project.plugins.withType(SigningPlugin) { + signingConfig(project) } } - private void config(Project project) { + def publishingConfig(Project project) { project.publishing { publications(publicationConfig(project)) repositories(repositoriesConfig(project)) } } - private publicationConfig(Project project) { + def signingConfig(Project project) { + project.signing { + def signingKeyId = project.findProperty('signingKeyId') + if (signingKeyId) { + def signingKey = project.findProperty('signingKey') + def signingPassword = project.findProperty('signingPassword') + if (signingKeyId && signingKey && signingPassword) { + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + } + sign project.publishing.publications + } + } + } + + def publicationConfig(Project project) { return { mavenJava(MavenPublication) { if (project.hasProperty('artifactId')) { @@ -58,7 +76,7 @@ class PublishConfigPlugin implements Plugin { } } - private repositoriesConfig(Project project) { + def repositoriesConfig(Project project) { return { maven { if (project.hasProperty("mavenCentral")) { @@ -77,11 +95,11 @@ class PublishConfigPlugin implements Plugin { } } - private static String getS3BucketUrl(Project project) { + static String getS3BucketUrl(Project project) { return "s3://orkes-artifacts-repo/${project.version.endsWith('-SNAPSHOT') ? 'snapshots' : 'releases'}" } - private static String getMavenRepoUrl(Project project) { + static String getMavenRepoUrl(Project project) { return "https://s01.oss.sonatype.org/${project.version.endsWith('-SNAPSHOT') ? 'content/repositories/snapshots/' : 'service/local/staging/deploy/maven2/'}" } -} \ No newline at end of file +} diff --git a/conductor-clients/java/conductor-java-sdk/conductor-client-spring/build.gradle b/conductor-clients/java/conductor-java-sdk/conductor-client-spring/build.gradle index 8b837b155..ff91af192 100644 --- a/conductor-clients/java/conductor-java-sdk/conductor-client-spring/build.gradle +++ b/conductor-clients/java/conductor-java-sdk/conductor-client-spring/build.gradle @@ -28,6 +28,11 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter:3.3.0' } +java { + withSourcesJar() + withJavadocJar() +} + test { useJUnitPlatform() -} \ No newline at end of file +} diff --git a/conductor-clients/java/conductor-java-sdk/orkes-spring/build.gradle b/conductor-clients/java/conductor-java-sdk/orkes-spring/build.gradle index eb30c76b7..d680f637f 100644 --- a/conductor-clients/java/conductor-java-sdk/orkes-spring/build.gradle +++ b/conductor-clients/java/conductor-java-sdk/orkes-spring/build.gradle @@ -33,6 +33,11 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter:3.3.0' } +java { + withSourcesJar() + withJavadocJar() +} + test { useJUnitPlatform() -} \ No newline at end of file +}