Skip to content

Commit

Permalink
fix: Gradle publish script
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed Moussa <[email protected]>
  • Loading branch information
hamada147 committed Dec 19, 2023
1 parent 19d506c commit ee090f2
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 97 deletions.
36 changes: 24 additions & 12 deletions apollo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ kotlin {
jvm {
withSourcesJar()
publishing {
publications.withType<MavenPublication> {
artifact(javadocJar)
publications {
withType<MavenPublication> {
artifact(javadocJar)
}
}
}
compilations.all {
Expand Down Expand Up @@ -390,20 +392,30 @@ afterEvaluate {
}
// Disable publish of targets
if (os.isMacOsX) {
tasks.named("publishIosX64PublicationToSonatypeRepository") {
this.enabled = false
if (tasks.findByName("publishIosX64PublicationToSonatypeRepository") != null) {
tasks.named("publishIosX64PublicationToSonatypeRepository") {
this.enabled = false
}
}
tasks.named("publishIosArm64PublicationToSonatypeRepository") {
this.enabled = false
if (tasks.findByName("publishIosArm64PublicationToSonatypeRepository") != null) {
tasks.named("publishIosArm64PublicationToSonatypeRepository") {
this.enabled = false
}
}
tasks.named("publishIosSimulatorArm64PublicationToSonatypeRepository") {
this.enabled = false
if (tasks.findByName("publishIosSimulatorArm64PublicationToSonatypeRepository") != null) {
tasks.named("publishIosSimulatorArm64PublicationToSonatypeRepository") {
this.enabled = false
}
}
tasks.named("publishMacosArm64PublicationToSonatypeRepository") {
this.enabled = false
if (tasks.findByName("publishMacosArm64PublicationToSonatypeRepository") != null) {
tasks.named("publishMacosArm64PublicationToSonatypeRepository") {
this.enabled = false
}
}
}
tasks.named("publishJsPublicationToSonatypeRepository") {
this.enabled = false
if (tasks.findByName("publishJsPublicationToSonatypeRepository") != null) {
tasks.named("publishJsPublicationToSonatypeRepository") {
this.enabled = false
}
}
}
178 changes: 93 additions & 85 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
id("maven-publish")
id("org.jetbrains.kotlinx.kover") version "0.7.4"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0-rc-1"
id("signing")
}

Expand Down Expand Up @@ -47,94 +48,97 @@ allprojects {

// Allowed projects to publish to maven
val allowedProjectsToPublish = listOf("apollo")
publishing {
if (allowedProjectsToPublish.contains(project.name)) {
publications.withType<MavenPublication> {
groupId = publishedMavenId
artifactId = project.name
version = project.version.toString()
pom {
name.set("Atala PRISM Apollo")
description.set("Collection of the cryptographic methods used all around Atala PRISM")
url.set("https://docs.atalaprism.io/")
organization {
name.set("IOG")
url.set("https://iog.io/")
}
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("hamada147")
name.set("Ahmed Moussa")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
developer {
id.set("amagyar-iohk")
name.set("Allain Magyar")
email.set("[email protected]")
organization.set("IOG")
roles.add("qc")
if (allowedProjectsToPublish.contains(project.name)) {
publishing {
publications {
withType<MavenPublication> {
groupId = publishedMavenId
artifactId = project.name
version = project.version.toString()
pom {
name.set("Atala PRISM Apollo")
description.set("Collection of the cryptographic methods used all around Atala PRISM")
url.set("https://docs.atalaprism.io/")
organization {
name.set("IOG")
url.set("https://iog.io/")
}
developer {
id.set("antonbaliasnikov")
name.set("Anton Baliasnikov")
email.set("[email protected]")
organization.set("IOG")
roles.add("qc")
issueManagement {
system.set("Github")
url.set("https://github.com/input-output-hk/atala-prism-apollo")
}
developer {
id.set("elribonazo")
name.set("Javier Ribó")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developer {
id.set("goncalo-frade-iohk")
name.set("Gonçalo Frade")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
developers {
developer {
id.set("hamada147")
name.set("Ahmed Moussa")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
developer {
id.set("amagyar-iohk")
name.set("Allain Magyar")
email.set("[email protected]")
organization.set("IOG")
roles.add("qc")
}
developer {
id.set("antonbaliasnikov")
name.set("Anton Baliasnikov")
email.set("[email protected]")
organization.set("IOG")
roles.add("qc")
}
developer {
id.set("elribonazo")
name.set("Javier Ribó")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
developer {
id.set("goncalo-frade-iohk")
name.set("Gonçalo Frade")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
developer {
id.set("curtis-h")
name.set("Curtis Harding")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
developer {
id.set("cristianIOHK")
name.set("Cristian Gonzalez")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
}
developer {
id.set("curtis-h")
name.set("Curtis Harding")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
}
developer {
id.set("cristianIOHK")
name.set("Cristian Gonzalez")
email.set("[email protected]")
organization.set("IOG")
roles.add("developer")
scm {
connection.set("scm:git:git://input-output-hk/atala-prism-apollo.git")
developerConnection.set("scm:git:ssh://input-output-hk/atala-prism-apollo.git")
url.set("https://github.com/input-output-hk/atala-prism-apollo")
}
}
scm {
connection.set("scm:git:git://input-output-hk/atala-prism-apollo.git")
developerConnection.set("scm:git:ssh://input-output-hk/atala-prism-apollo.git")
url.set("https://github.com/input-output-hk/atala-prism-apollo")
signing {
val base64EncodedAsciiArmoredSigningKey: String = System.getenv("BASE64_ARMORED_GPG_SIGNING_KEY_MAVEN") ?: ""
val signingKeyPassword: String = System.getenv("SIGNING_KEY_PASSWORD") ?: ""
useInMemoryPgpKeys(String(Base64.getDecoder().decode(base64EncodedAsciiArmoredSigningKey.toByteArray())), signingKeyPassword)
sign(this@withType)
}
}
}
repositories {
// Maven Central
maven {
name = "Sonatype"
url = uri("https://oss.sonatype.org/service/local/")
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
}
}
// GitHub Maven Repo
// maven {
// this.name = "GitHubPackages"
Expand All @@ -147,13 +151,6 @@ allprojects {
}
}
}

signing {
val base64EncodedAsciiArmoredSigningKey: String = System.getenv("BASE64_ARMORED_GPG_SIGNING_KEY_MAVEN") ?: ""
val signingKeyPassword: String = System.getenv("SIGNING_KEY_PASSWORD") ?: ""
useInMemoryPgpKeys(String(Base64.getDecoder().decode(base64EncodedAsciiArmoredSigningKey.toByteArray())), signingKeyPassword)
sign(publishing.publications)
}
}

subprojects {
Expand Down Expand Up @@ -192,3 +189,14 @@ subprojects {
rootProject.plugins.withType(NodeJsRootPlugin::class.java) {
rootProject.extensions.getByType(NodeJsRootExtension::class.java).nodeVersion = "16.17.0"
}

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}
6 changes: 6 additions & 0 deletions iOSLibs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,10 @@ afterEvaluate {
tasks.named("clean") {
dependsOn(deleteBuildFolder)
}
tasks.withType<PublishToMavenRepository>().configureEach {
enabled = false
}
tasks.withType<PublishToMavenLocal>().configureEach {
enabled = false
}
}
9 changes: 9 additions & 0 deletions secp256k1-kmp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,12 @@ kotlin {
// compilations["main"].kotlinOptions.freeCompilerArgs += listOf("-include-binary", "$rootDir/secp256k1-kmp/native/build/ios/arm64-appletvos/libsecp256k1.a")
// }
}

afterEvaluate {
tasks.withType<PublishToMavenRepository>().configureEach {
enabled = false
}
tasks.withType<PublishToMavenLocal>().configureEach {
enabled = false
}
}
6 changes: 6 additions & 0 deletions secp256k1-kmp/native/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,10 @@ afterEvaluate {
tasks.named("clean") {
dependsOn(deleteBuildFolder)
}
tasks.withType<PublishToMavenRepository>().configureEach {
enabled = false
}
tasks.withType<PublishToMavenLocal>().configureEach {
enabled = false
}
}

0 comments on commit ee090f2

Please sign in to comment.