Skip to content

Commit

Permalink
Merge pull request #270 from conductor-oss/fix/client-v4-gradle-confi…
Browse files Browse the repository at this point in the history
…g-cleanup

[Java Client v4] Gradle config refactoring
  • Loading branch information
jmigueprieto authored Sep 20, 2024
2 parents 3c92737 + ecfee86 commit 1fc924f
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 368 deletions.
2 changes: 1 addition & 1 deletion conductor-clients/java/conductor-java-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apply from: "$rootDir/versions.gradle"
subprojects {
apply plugin: 'java'
apply plugin: 'com.diffplug.spotless'
group = 'io.orkes.conductor'
group = 'org.conductoross'

spotless {
java {
Expand Down
12 changes: 12 additions & 0 deletions conductor-clients/java/conductor-java-sdk/buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id 'groovy'
}

repositories {
mavenCentral()
}

dependencies {
implementation gradleApi()
implementation localGroovy()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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.api.publish.maven.MavenPublication
import org.gradle.authentication.aws.AwsImAuthentication


class PublishConfigPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
project.plugins.withType(MavenPublishPlugin) {
config(project)
}
}

private void config(Project project) {
project.publishing {
publications(publicationConfig(project))
repositories(repositoriesConfig(project))
}
}

private publicationConfig(Project project) {
return {
mavenJava(MavenPublication) {
from project.components.java
pom {
name = project.findProperty('artifactName')
description = project.findProperty('artifactDescription')
url = 'https://github.com/conductor-oss/conductor.git'
scm {
connection = 'scm:git:git://github.com/conductor-oss/conductor.git'
developerConnection = 'scm:git:ssh://github.com/conductor-oss/conductor.git'
url = 'https://github.com/conductor-oss/conductor.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
organization = 'Orkes'
organizationUrl = 'https://orkes.io'
name = 'Orkes Development Team'
email = '[email protected]'
}
}
}
}
}
}

private repositoriesConfig(Project project) {
return {
maven {
if (project.hasProperty("mavenCentral")) {
url = getMavenRepoUrl(project)
credentials {
username = project.properties['username']
password = project.properties['password']
}
} else {
url = getS3BucketUrl(project)
authentication {
awsIm(AwsImAuthentication)
}
}
}
}
}

private static String getS3BucketUrl(Project project) {
return "s3://orkes-artifacts-repo/${project.version.endsWith('-SNAPSHOT') ? 'snapshots' : 'releases'}"
}

private static String getMavenRepoUrl(Project project) {
return "https://s01.oss.sonatype.org/${project.version.endsWith('-SNAPSHOT') ? 'content/repositories/snapshots/' : 'service/local/staging/deploy/maven2/'}"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
implementation-class=io.orkes.conductor.gradle.PublishConfigPlugin
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ plugins {
id 'signing'
}

ext {
artifactName = 'Conductor Client Metrics'
artifactDescription = 'Conductor Client Metrics'
}

apply plugin: 'publish-config'

dependencies {
implementation 'io.micrometer:micrometer-registry-prometheus:1.10.5'
implementation project(":conductor-client")
Expand All @@ -19,72 +26,6 @@ java {
withJavadocJar()
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'Orkes Conductor Metrics module'
description = 'OSS & Orkes Conductor Metrics'
url = 'https://github.com/conductor-oss/conductor.git'
scm {
connection = 'scm:git:git://github.com/conductor-oss/conductor.git'
developerConnection = 'scm:git:ssh://github.com/conductor-oss/conductor.git'
url = 'https://github.com/conductor-oss/conductor.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
organization = 'Orkes'
organizationUrl = 'https://orkes.io'
name = 'Orkes Development Team'
email = '[email protected]'
}
}
}
}
}

repositories {
maven {
if (project.hasProperty("mavenCentral")) {
println "Publishing to Sonatype Repository"
url = "https://s01.oss.sonatype.org/${project.version.endsWith('-SNAPSHOT') ? "content/repositories/snapshots/" : "service/local/staging/deploy/maven2/"}"
credentials {
username project.properties.username
password project.properties.password
}
} else {
url = "s3://orkes-artifacts-repo/${project.version.endsWith('-SNAPSHOT') ? "snapshots" : "releases"}"
authentication {
awsIm(AwsImAuthentication)
}
}
}
}
}

signing {
def signingKeyId = findProperty('signingKeyId')
if (signingKeyId) {
println 'Signing the artifact with keys'
signing {
def signingKey = findProperty('signingKey')
def signingPassword = findProperty('signingPassword')
if (signingKeyId && signingKey && signingPassword) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
}

sign publishing.publications
}
}
}

test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ plugins {
id 'signing'
}

ext {
artifactName = 'Conductor OSS Client Spring'
artifactDescription = 'Spring autoconfig for Conductor Client and SDK'
}

apply plugin: 'publish-config'

compileJava {
sourceCompatibility = 17
targetCompatibility = 17
Expand All @@ -21,56 +28,6 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter:3.3.0'
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'Conductor OSS Client Spring'
description = 'Spring autoconfig for Conductor Client and SDK'
url = 'https://github.com/conductor-oss/conductor.git'
scm {
connection = 'scm:git:git://github.com/conductor-oss/conductor.git'
developerConnection = 'scm:git:ssh://github.com/conductor-oss/conductor.git'
url = 'https://github.com/conductor-oss/conductor.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
organization = 'Orkes'
organizationUrl = 'https://orkes.io'
name = 'Orkes Development Team'
email = '[email protected]'
}
}
}
}
}

repositories {
maven {
if (project.hasProperty("mavenCentral")) {
println "Publishing to Sonatype Repository"
url = "https://s01.oss.sonatype.org/${project.version.endsWith('-SNAPSHOT') ? "content/repositories/snapshots/" : "service/local/staging/deploy/maven2/"}"
credentials {
username project.properties.username
password project.properties.password
}
} else {
url = "s3://orkes-artifacts-repo/${project.version.endsWith('-SNAPSHOT') ? "snapshots" : "releases"}"
authentication {
awsIm(AwsImAuthentication)
}
}
}
}
}

test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ plugins {
id 'groovy'
}

ext {
artifactName = 'Conductor Client'
artifactDescription = 'Conductor OSS client (http)'
}

apply plugin: 'publish-config'

dependencies {
implementation "com.squareup.okhttp3:okhttp:${versions.okHttp}"

Expand All @@ -27,72 +34,6 @@ java {
withJavadocJar()
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'Conductor Client'
description = 'Conductor OSS client (http)'
url = 'https://github.com/conductor-oss/conductor.git'
scm {
connection = 'scm:git:git://github.com/conductor-oss/conductor.git'
developerConnection = 'scm:git:ssh://github.com/conductor-oss/conductor.git'
url = 'https://github.com/conductor-oss/conductor.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
organization = 'Orkes'
organizationUrl = 'https://orkes.io'
name = 'Orkes Development Team'
email = '[email protected]'
}
}
}
}
}

repositories {
maven {
if (project.hasProperty("mavenCentral")) {
println "Publishing to Sonatype Repository"
url = "https://s01.oss.sonatype.org/${project.version.endsWith('-SNAPSHOT') ? "content/repositories/snapshots/" : "service/local/staging/deploy/maven2/"}"
credentials {
username project.properties.username
password project.properties.password
}
} else {
url = "s3://orkes-artifacts-repo/${project.version.endsWith('-SNAPSHOT') ? "snapshots" : "releases"}"
authentication {
awsIm(AwsImAuthentication)
}
}
}
}
}

signing {
def signingKeyId = findProperty('signingKeyId')
if (signingKeyId) {
println 'Signing the artifact with keys'
signing {
def signingKey = findProperty('signingKey')
def signingPassword = findProperty('signingPassword')
if (signingKeyId && signingKey && signingPassword) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
}

sign publishing.publications
}
}
}

test {
useJUnitPlatform()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ plugins {
id 'java'
}

group 'io.orkes.conductor'
version '3.0.0'

repositories {
mavenCentral()
}
Expand Down
Loading

0 comments on commit 1fc924f

Please sign in to comment.