From 755583a2dd7b740d5f4c921e669a4a18386747f3 Mon Sep 17 00:00:00 2001 From: Allain Magyar Date: Fri, 13 Sep 2024 14:13:06 -0300 Subject: [PATCH] fix: gradle artifact signing Signed-off-by: Allain Magyar --- build.gradle.kts | 113 +------------------------------- edge-agent-sdk/build.gradle.kts | 107 ++++++++++++++++++++++++++++++ gradle.properties | 2 +- 3 files changed, 110 insertions(+), 112 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 760abb3b8..4f0432c62 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -val publishedMavenId = "org.hyperledger.identus" +val groupId = "org.hyperledger.identus" val os: OperatingSystem = OperatingSystem.current() plugins { @@ -10,8 +10,6 @@ plugins { id("org.jlleitschuh.gradle.ktlint") version "12.1.0" id("org.jetbrains.dokka") version "1.9.20" id("org.jetbrains.kotlin.kapt") version "1.9.10" - id("maven-publish") - id("signing") id("io.github.gradle-nexus.publish-plugin") version "2.0.0" } @@ -37,7 +35,7 @@ java { } allprojects { - this.group = publishedMavenId + this.group = groupId repositories { mavenLocal() @@ -101,113 +99,6 @@ subprojects { } } } - - if (this.name == "edge-agent-sdk") { - apply(plugin = "org.gradle.maven-publish") - apply(plugin = "org.gradle.signing") - - publishing { - repositories { - maven { - name = "OSSRH" - url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = - project.findProperty("sonatypeUsername") as String? ?: System.getenv("OSSRH_USERNAME") - password = project.findProperty("sonatypePassword") as String? ?: System.getenv("OSSRH_TOKEN") - } - } - } - publications { - withType { - groupId = publishedMavenId - artifactId = project.name - version = project.version.toString() - pom { - name.set("Edge Agent SDK") - description.set(" Edge Agent SDK - Kotlin Multiplatform (Android/JVM)") - url.set("https://docs.atalaprism.io/") - organization { - name.set("Hyperledger") - url.set("https://hyperledger.org/") - } - issueManagement { - system.set("Github") - url.set("https://github.com/hyperledger/identus-edge-agent-sdk-kmp") - } - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - id.set("cristianIOHK") - name.set("Cristian Gonzalez") - email.set("cristian.castro@iohk.io") - organization.set("IOG") - roles.add("developer") - url.set("https://github.com/cristianIOHK") - } - developer { - id.set("hamada147") - name.set("Ahmed Moussa") - email.set("ahmed.moussa@iohk.io") - organization.set("IOG") - roles.add("developer") - url.set("https://github.com/hamada147") - } - developer { - id.set("elribonazo") - name.set("Javier Ribó") - email.set("javier.ribo@iohk.io") - organization.set("IOG") - roles.add("developer") - } - developer { - id.set("amagyar-iohk") - name.set("Allain Magyar") - email.set("allain.magyar@iohk.io") - organization.set("IOG") - roles.add("qc") - } - developer { - id.set("antonbaliasnikov") - name.set("Anton Baliasnikov") - email.set("anton.baliasnikov@iohk.io") - organization.set("IOG") - roles.add("qc") - } - developer { - id.set("goncalo-frade-iohk") - name.set("Gonçalo Frade") - email.set("goncalo.frade@iohk.io") - organization.set("IOG") - roles.add("developer") - } - } - scm { - connection.set("scm:git:git://hyperledger/identus-edge-agent-sdk-kmp.git") - developerConnection.set("scm:git:ssh://hyperledger/identus-edge-agent-sdk-kmp.git") - url.set("https://github.com/hyperledger/identus-edge-agent-sdk-kmp") - } - } - if (System.getenv().containsKey("OSSRH_GPG_SECRET_KEY")) { - signing { - useInMemoryPgpKeys( - project.findProperty("signing.signingSecretKey") as String? - ?: System.getenv("OSSRH_GPG_SECRET_KEY"), - project.findProperty("signing.signingSecretKeyPassword") as String? - ?: System.getenv("OSSRH_GPG_SECRET_KEY_PASSWORD") - ) - sign(this@withType) - } - } - } - } - } - } } nexusPublishing { diff --git a/edge-agent-sdk/build.gradle.kts b/edge-agent-sdk/build.gradle.kts index ba2cfcb5d..98da89c29 100644 --- a/edge-agent-sdk/build.gradle.kts +++ b/edge-agent-sdk/build.gradle.kts @@ -17,6 +17,107 @@ plugins { id("com.android.library") id("org.jetbrains.dokka") id("org.jetbrains.kotlinx.kover") version "0.7.6" + id("org.gradle.maven-publish") + id("org.gradle.signing") +} + +publishing { + repositories { + maven { + name = "OSSRH" + url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = System.getenv("OSSRH_USERNAME") + password = System.getenv("OSSRH_TOKEN") + } + } + } + publications { + withType { + artifactId = project.name + version = project.version.toString() + pom { + name.set("Edge Agent SDK") + description.set(" Edge Agent SDK - Kotlin Multiplatform (Android/JVM)") + url.set("https://docs.atalaprism.io/") + organization { + name.set("Hyperledger") + url.set("https://hyperledger.org/") + } + issueManagement { + system.set("Github") + url.set("https://github.com/hyperledger/identus-edge-agent-sdk-kmp") + } + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + developers { + developer { + id.set("cristianIOHK") + name.set("Cristian Gonzalez") + email.set("cristian.castro@iohk.io") + organization.set("IOG") + roles.add("developer") + url.set("https://github.com/cristianIOHK") + } + developer { + id.set("hamada147") + name.set("Ahmed Moussa") + email.set("ahmed.moussa@iohk.io") + organization.set("IOG") + roles.add("developer") + url.set("https://github.com/hamada147") + } + developer { + id.set("elribonazo") + name.set("Javier Ribó") + email.set("javier.ribo@iohk.io") + organization.set("IOG") + roles.add("developer") + } + developer { + id.set("amagyar-iohk") + name.set("Allain Magyar") + email.set("allain.magyar@iohk.io") + organization.set("IOG") + roles.add("qc") + } + developer { + id.set("antonbaliasnikov") + name.set("Anton Baliasnikov") + email.set("anton.baliasnikov@iohk.io") + organization.set("IOG") + roles.add("qc") + } + developer { + id.set("goncalo-frade-iohk") + name.set("Gonçalo Frade") + email.set("goncalo.frade@iohk.io") + organization.set("IOG") + roles.add("developer") + } + } + scm { + connection.set("scm:git:git://hyperledger/identus-edge-agent-sdk-kmp.git") + developerConnection.set("scm:git:ssh://hyperledger/identus-edge-agent-sdk-kmp.git") + url.set("https://github.com/hyperledger/identus-edge-agent-sdk-kmp") + } + } + } + } +} + +if (System.getenv().containsKey("OSSRH_GPG_SECRET_KEY")) { + signing { + useInMemoryPgpKeys( + System.getenv("OSSRH_GPG_SECRET_KEY"), + System.getenv("OSSRH_GPG_SECRET_KEY_PASSWORD") + ) + sign(publishing.publications) + } } kover { @@ -279,6 +380,12 @@ val buildProtoLibsGen: Task by tasks.creating { } afterEvaluate { + tasks.withType { + dependsOn(tasks.withType()) + } + tasks.withType { + dependsOn(tasks.withType()) + } tasks.getByName("runKtlintCheckOverCommonMainSourceSet") { dependsOn(buildProtoLibsGen) } diff --git a/gradle.properties b/gradle.properties index e18b58edf..2116692a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version = 3.0.0 +version = 3.0.0-TEST5 org.gradle.jvmargs = -Xmx3072M -Dkotlin.daemon.jvm.options="-Xmx3072M" kotlin.code.style = official android.useAndroidX = true