|
| 1 | +import org.gradle.api.publish.maven.MavenPublication |
| 2 | +import org.gradle.kotlin.dsl.extra |
| 3 | +import org.gradle.kotlin.dsl.provideDelegate |
| 4 | + |
| 5 | +plugins { |
| 6 | + `maven-publish` |
| 7 | + signing |
| 8 | +} |
| 9 | + |
| 10 | +publishing { |
| 11 | + // Add license spec to all maven publications |
| 12 | + publications { |
| 13 | + afterEvaluate { |
| 14 | + create<MavenPublication>("maven") { |
| 15 | + from(components["java"]) |
| 16 | + val displayName: String by extra |
| 17 | + pom { |
| 18 | + name.set(displayName) |
| 19 | + description.set(project.description) |
| 20 | + url.set("https://github.com/juspay/superposition") |
| 21 | + licenses { |
| 22 | + license { |
| 23 | + name.set("Apache License 2.0") |
| 24 | + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") |
| 25 | + } |
| 26 | + } |
| 27 | + developers { |
| 28 | + developer { |
| 29 | + id.set("superposition") |
| 30 | + name.set("superposition") |
| 31 | + email.set("superposition@juspay.in") |
| 32 | + organization.set("Juspay") |
| 33 | + organizationUrl.set("https://juspay.io") |
| 34 | + roles.add("developer") |
| 35 | + } |
| 36 | + } |
| 37 | + scm { |
| 38 | + connection.set("https://github.com/juspay/superposition.git") |
| 39 | + developerConnection.set("https://github.com/juspay/superposition.git") |
| 40 | + url.set("https://github.com/juspay/superposition.git") |
| 41 | + } |
| 42 | + } |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | +signing { |
| 49 | + setRequired { |
| 50 | + // signing is required only if the artifacts are to be published to a maven repository |
| 51 | + gradle.taskGraph.allTasks.any { it is PublishToMavenRepository } |
| 52 | + } |
| 53 | + |
| 54 | + // Don't sign the artifacts if we didn't get a key and password to use. |
| 55 | + if (project.hasProperty("signingKey") && project.hasProperty("signingPassword")) { |
| 56 | + signing { |
| 57 | + useInMemoryPgpKeys( |
| 58 | + project.properties["signingKey"].toString(), |
| 59 | + project.properties["signingPassword"].toString()) |
| 60 | + sign(publishing.publications) |
| 61 | + } |
| 62 | + } |
| 63 | +} |
0 commit comments