[#880] Refactor publishing into convention plugin
This commit is contained in:
parent
1c76ea6998
commit
afba5b74a6
|
@ -1,6 +1,7 @@
|
|||
import com.android.build.api.dsl.CommonExtension
|
||||
import com.android.build.api.dsl.ManagedVirtualDevice
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
|
||||
import java.util.Locale
|
||||
|
||||
pluginManager.withPlugin("com.android.application") {
|
||||
project.the<com.android.build.gradle.AppExtension>().apply {
|
||||
|
@ -55,6 +56,27 @@ pluginManager.withPlugin("com.android.library") {
|
|||
jacocoVersion = project.property("JACOCO_VERSION").toString()
|
||||
}
|
||||
}
|
||||
|
||||
project.the<com.android.build.api.variant.LibraryAndroidComponentsExtension>().apply {
|
||||
onVariants { variant ->
|
||||
if (variant.name.toLowerCase(Locale.US).contains("release")) {
|
||||
variant.packaging.resources.excludes.addAll(
|
||||
listOf(
|
||||
"META-INF/ASL2.0",
|
||||
"META-INF/DEPENDENCIES",
|
||||
"META-INF/LICENSE",
|
||||
"META-INF/LICENSE-notice.md",
|
||||
"META-INF/LICENSE.md",
|
||||
"META-INF/LICENSE.txt",
|
||||
"META-INF/NOTICE",
|
||||
"META-INF/NOTICE.txt",
|
||||
"META-INF/license.txt",
|
||||
"META-INF/notice.txt"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("com.android.test") {
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
import java.util.Base64
|
||||
|
||||
val publicationVariant = "release"
|
||||
val isSnapshot = project.property("IS_SNAPSHOT").toString().toBoolean()
|
||||
val myVersion = project.property("LIBRARY_VERSION").toString()
|
||||
|
||||
val myGroup = "cash.z.ecc.android"
|
||||
project.group = myGroup
|
||||
|
||||
pluginManager.withPlugin("com.android.library") {
|
||||
project.the<com.android.build.gradle.LibraryExtension>().apply {
|
||||
publishing {
|
||||
singleVariant(publicationVariant) {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("org.gradle.maven-publish") {
|
||||
val publishingExtension = extensions.getByType<PublishingExtension>().apply {
|
||||
publications {
|
||||
register<MavenPublication>("release") {
|
||||
groupId = myGroup
|
||||
version = if (isSnapshot) {
|
||||
"$myVersion-SNAPSHOT"
|
||||
} else {
|
||||
myVersion
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
from(components[publicationVariant])
|
||||
}
|
||||
|
||||
pom {
|
||||
name.set("Zcash Android Wallet SDK")
|
||||
description.set(
|
||||
"This lightweight SDK connects Android to Zcash, allowing third-party " +
|
||||
"Android apps to send and receive shielded transactions easily, securely and privately."
|
||||
)
|
||||
url.set("https://github.com/zcash/zcash-android-wallet-sdk/")
|
||||
inceptionYear.set("2018")
|
||||
scm {
|
||||
url.set("https://github.com/zcash/zcash-android-wallet-sdk/")
|
||||
connection.set("scm:git:git://github.com/zcash/zcash-android-wallet-sdk.git")
|
||||
developerConnection.set("scm:git:ssh://git@github.com/zcash/zcash-android-wallet-sdk.git")
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("zcash")
|
||||
name.set("Zcash")
|
||||
url.set("https://github.com/zcash/")
|
||||
}
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name.set("The MIT License")
|
||||
url.set("http://opensource.org/licenses/MIT")
|
||||
distribution.set("repo")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
val mavenUrl = if (isSnapshot) {
|
||||
project.property("ZCASH_MAVEN_PUBLISH_SNAPSHOT_URL").toString()
|
||||
} else {
|
||||
project.property("ZCASH_MAVEN_PUBLISH_RELEASE_URL").toString()
|
||||
}
|
||||
val mavenPublishUsername = project.property("ZCASH_MAVEN_PUBLISH_USERNAME").toString()
|
||||
val mavenPublishPassword = project.property("ZCASH_MAVEN_PUBLISH_PASSWORD").toString()
|
||||
|
||||
mavenLocal {
|
||||
name = "MavenLocal"
|
||||
}
|
||||
maven(mavenUrl) {
|
||||
name = "MavenCentral"
|
||||
credentials {
|
||||
username = mavenPublishUsername
|
||||
password = mavenPublishPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("org.gradle.signing") {
|
||||
project.the<SigningExtension>().apply {
|
||||
// Maven Central requires signing for non-snapshots
|
||||
isRequired = !isSnapshot
|
||||
|
||||
val signingKey = run {
|
||||
val base64EncodedKey = project.property("ZCASH_ASCII_GPG_KEY").toString()
|
||||
if (base64EncodedKey.isNotEmpty()) {
|
||||
val keyBytes = Base64.getDecoder().decode(base64EncodedKey)
|
||||
String(keyBytes)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
if (signingKey.isNotEmpty()) {
|
||||
useInMemoryPgpKeys(signingKey, "")
|
||||
}
|
||||
|
||||
sign(publishingExtension.publications)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,75 +19,13 @@ plugins {
|
|||
|
||||
id("maven-publish")
|
||||
id("signing")
|
||||
id("zcash-sdk.publishing-conventions")
|
||||
}
|
||||
|
||||
// Publishing information
|
||||
val publicationVariant = "release"
|
||||
val myVersion = project.property("LIBRARY_VERSION").toString()
|
||||
val myArtifactId = "lightwallet-client"
|
||||
val isSnapshot = project.property("IS_SNAPSHOT").toString().toBoolean()
|
||||
project.group = "cash.z.ecc.android"
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
register<MavenPublication>("release") {
|
||||
groupId = "cash.z.ecc.android"
|
||||
artifactId = myArtifactId
|
||||
version = if (isSnapshot) {
|
||||
"$myVersion-SNAPSHOT"
|
||||
} else {
|
||||
myVersion
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
from(components[publicationVariant])
|
||||
}
|
||||
|
||||
pom {
|
||||
name.set("Zcash Light Wallet Client")
|
||||
description.set("Client API for connecting to the Light Wallet server.")
|
||||
url.set("https://github.com/zcash/zcash-android-wallet-sdk/")
|
||||
inceptionYear.set("2022")
|
||||
scm {
|
||||
url.set("https://github.com/zcash/zcash-android-wallet-sdk/")
|
||||
connection.set("scm:git:git://github.com/zcash/zcash-android-wallet-sdk.git")
|
||||
developerConnection.set("scm:git:ssh://git@github.com/zcash/zcash-android-wallet-sdk.git")
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("zcash")
|
||||
name.set("Zcash")
|
||||
url.set("https://github.com/zcash/")
|
||||
}
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name.set("The MIT License")
|
||||
url.set("http://opensource.org/licenses/MIT")
|
||||
distribution.set("repo")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
val mavenUrl = if (isSnapshot) {
|
||||
project.property("ZCASH_MAVEN_PUBLISH_SNAPSHOT_URL").toString()
|
||||
} else {
|
||||
project.property("ZCASH_MAVEN_PUBLISH_RELEASE_URL").toString()
|
||||
}
|
||||
val mavenPublishUsername = project.property("ZCASH_MAVEN_PUBLISH_USERNAME").toString()
|
||||
val mavenPublishPassword = project.property("ZCASH_MAVEN_PUBLISH_PASSWORD").toString()
|
||||
|
||||
mavenLocal {
|
||||
name = "MavenLocal"
|
||||
}
|
||||
maven(mavenUrl) {
|
||||
name = "MavenCentral"
|
||||
credentials {
|
||||
username = mavenPublishUsername
|
||||
password = mavenPublishPassword
|
||||
}
|
||||
publications.withType<MavenPublication>().all {
|
||||
artifactId = "lightwallet-client"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,34 +65,6 @@ android {
|
|||
lint {
|
||||
baseline = File("lint-baseline.xml")
|
||||
}
|
||||
|
||||
publishing {
|
||||
singleVariant(publicationVariant) {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants { variant ->
|
||||
if (variant.name.toLowerCase(Locale.US).contains("release")) {
|
||||
variant.packaging.resources.excludes.addAll(
|
||||
listOf(
|
||||
"META-INF/ASL2.0",
|
||||
"META-INF/DEPENDENCIES",
|
||||
"META-INF/LICENSE",
|
||||
"META-INF/LICENSE-notice.md",
|
||||
"META-INF/LICENSE.md",
|
||||
"META-INF/LICENSE.txt",
|
||||
"META-INF/NOTICE",
|
||||
"META-INF/NOTICE.txt",
|
||||
"META-INF/license.txt",
|
||||
"META-INF/notice.txt"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.dokkaHtml.configure {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import java.util.Base64
|
||||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
|
@ -12,100 +10,15 @@ plugins {
|
|||
|
||||
id("maven-publish")
|
||||
id("signing")
|
||||
id("zcash-sdk.publishing-conventions")
|
||||
}
|
||||
|
||||
// Publishing information
|
||||
val publicationVariant = "release"
|
||||
val myVersion = project.property("LIBRARY_VERSION").toString()
|
||||
val myArtifactId = "zcash-android-sdk-incubator"
|
||||
val isSnapshot = project.property("IS_SNAPSHOT").toString().toBoolean()
|
||||
val version = project.property("LIBRARY_VERSION").toString()
|
||||
project.group = "cash.z.ecc.android"
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
register<MavenPublication>("release") {
|
||||
artifactId = myArtifactId
|
||||
groupId = "cash.z.ecc.android"
|
||||
version = if (isSnapshot) {
|
||||
"$myVersion-SNAPSHOT"
|
||||
} else {
|
||||
myVersion
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
from(components[publicationVariant])
|
||||
}
|
||||
|
||||
pom {
|
||||
name.set("Zcash Android Wallet SDK In")
|
||||
description.set("This lightweight SDK connects Android to Zcash, allowing third-party " +
|
||||
"Android apps to send and receive shielded transactions easily, securely and privately.")
|
||||
url.set("https://github.com/zcash/zcash-android-wallet-sdk/")
|
||||
inceptionYear.set("2018")
|
||||
scm {
|
||||
url.set("https://github.com/zcash/zcash-android-wallet-sdk/")
|
||||
connection.set("scm:git:git://github.com/zcash/zcash-android-wallet-sdk.git")
|
||||
developerConnection.set("scm:git:ssh://git@github.com/zcash/zcash-android-wallet-sdk.git")
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("zcash")
|
||||
name.set("Zcash")
|
||||
url.set("https://github.com/zcash/")
|
||||
publications.withType<MavenPublication>().all {
|
||||
artifactId = "zcash-android-sdk-incubator"
|
||||
}
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name.set("The MIT License")
|
||||
url.set("http://opensource.org/licenses/MIT")
|
||||
distribution.set("repo")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
val mavenUrl = if (isSnapshot) {
|
||||
project.property("ZCASH_MAVEN_PUBLISH_SNAPSHOT_URL").toString()
|
||||
} else {
|
||||
project.property("ZCASH_MAVEN_PUBLISH_RELEASE_URL").toString()
|
||||
}
|
||||
val mavenPublishUsername = project.property("ZCASH_MAVEN_PUBLISH_USERNAME").toString()
|
||||
val mavenPublishPassword = project.property("ZCASH_MAVEN_PUBLISH_PASSWORD").toString()
|
||||
|
||||
mavenLocal {
|
||||
name = "MavenLocal"
|
||||
}
|
||||
maven(mavenUrl) {
|
||||
name = "MavenCentral"
|
||||
credentials {
|
||||
username = mavenPublishUsername
|
||||
password = mavenPublishPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
// Maven Central requires signing for non-snapshots
|
||||
isRequired = !isSnapshot
|
||||
|
||||
val signingKey = run {
|
||||
val base64EncodedKey = project.property("ZCASH_ASCII_GPG_KEY").toString()
|
||||
if (base64EncodedKey.isNotEmpty()) {
|
||||
val keyBytes = Base64.getDecoder().decode(base64EncodedKey)
|
||||
String(keyBytes)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
if (signingKey.isNotEmpty()) {
|
||||
useInMemoryPgpKeys(signingKey, "")
|
||||
}
|
||||
|
||||
sign(publishing.publications)
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -136,37 +49,8 @@ android {
|
|||
matchingFallbacks += listOf("release")
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
resources.excludes.addAll(
|
||||
listOf(
|
||||
"META-INF/DEPENDENCIES",
|
||||
"META-INF/LICENSE",
|
||||
"META-INF/LICENSE.txt",
|
||||
"META-INF/license.txt",
|
||||
"META-INF/NOTICE",
|
||||
"META-INF/NOTICE.txt",
|
||||
"META-INF/notice.txt",
|
||||
"META-INF/ASL2.0",
|
||||
"META-INF/LICENSE.md",
|
||||
"META-INF/LICENSE-notice.md"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
lint {
|
||||
baseline = File("lint-baseline.xml")
|
||||
}
|
||||
|
||||
publishing {
|
||||
singleVariant(publicationVariant) {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tasks.dokkaHtml.configure {
|
||||
dokkaSourceSets {
|
||||
configureEach {
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import java.util.Base64
|
||||
import java.util.Locale
|
||||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
|
@ -16,100 +13,19 @@ plugins {
|
|||
|
||||
id("maven-publish")
|
||||
id("signing")
|
||||
id("zcash-sdk.publishing-conventions")
|
||||
}
|
||||
|
||||
// Publishing information
|
||||
val publicationVariant = "release"
|
||||
|
||||
val myVersion = project.property("LIBRARY_VERSION").toString()
|
||||
val myArtifactId = "zcash-android-sdk"
|
||||
val isSnapshot = project.property("IS_SNAPSHOT").toString().toBoolean()
|
||||
val version = project.property("LIBRARY_VERSION").toString()
|
||||
project.group = "cash.z.ecc.android"
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
register<MavenPublication>("release") {
|
||||
publications.withType<MavenPublication>().all {
|
||||
artifactId = myArtifactId
|
||||
groupId = "cash.z.ecc.android"
|
||||
version = if (isSnapshot) {
|
||||
"$myVersion-SNAPSHOT"
|
||||
} else {
|
||||
myVersion
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
from(components[publicationVariant])
|
||||
}
|
||||
|
||||
pom {
|
||||
name.set("Zcash Android Wallet SDK")
|
||||
description.set("This lightweight SDK connects Android to Zcash, allowing third-party " +
|
||||
"Android apps to send and receive shielded transactions easily, securely and privately.")
|
||||
url.set("https://github.com/zcash/zcash-android-wallet-sdk/")
|
||||
inceptionYear.set("2018")
|
||||
scm {
|
||||
url.set("https://github.com/zcash/zcash-android-wallet-sdk/")
|
||||
connection.set("scm:git:git://github.com/zcash/zcash-android-wallet-sdk.git")
|
||||
developerConnection.set("scm:git:ssh://git@github.com/zcash/zcash-android-wallet-sdk.git")
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("zcash")
|
||||
name.set("Zcash")
|
||||
url.set("https://github.com/zcash/")
|
||||
}
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name.set("The MIT License")
|
||||
url.set("http://opensource.org/licenses/MIT")
|
||||
distribution.set("repo")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
val mavenUrl = if (isSnapshot) {
|
||||
project.property("ZCASH_MAVEN_PUBLISH_SNAPSHOT_URL").toString()
|
||||
} else {
|
||||
project.property("ZCASH_MAVEN_PUBLISH_RELEASE_URL").toString()
|
||||
}
|
||||
val mavenPublishUsername = project.property("ZCASH_MAVEN_PUBLISH_USERNAME").toString()
|
||||
val mavenPublishPassword = project.property("ZCASH_MAVEN_PUBLISH_PASSWORD").toString()
|
||||
|
||||
mavenLocal {
|
||||
name = "MavenLocal"
|
||||
}
|
||||
maven(mavenUrl) {
|
||||
name = "MavenCentral"
|
||||
credentials {
|
||||
username = mavenPublishUsername
|
||||
password = mavenPublishPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
// Maven Central requires signing for non-snapshots
|
||||
isRequired = !isSnapshot
|
||||
|
||||
val signingKey = run {
|
||||
val base64EncodedKey = project.property("ZCASH_ASCII_GPG_KEY").toString()
|
||||
if (base64EncodedKey.isNotEmpty()) {
|
||||
val keyBytes = Base64.getDecoder().decode(base64EncodedKey)
|
||||
String(keyBytes)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
if (signingKey.isNotEmpty()) {
|
||||
useInMemoryPgpKeys(signingKey, "")
|
||||
}
|
||||
|
||||
sign(publishing.publications)
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -156,34 +72,6 @@ android {
|
|||
lint {
|
||||
baseline = File("lint-baseline.xml")
|
||||
}
|
||||
|
||||
publishing {
|
||||
singleVariant(publicationVariant) {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants { variant ->
|
||||
if (variant.name.toLowerCase(Locale.US).contains("release")) {
|
||||
variant.packaging.resources.excludes.addAll(
|
||||
listOf(
|
||||
"META-INF/ASL2.0",
|
||||
"META-INF/DEPENDENCIES",
|
||||
"META-INF/LICENSE",
|
||||
"META-INF/LICENSE-notice.md",
|
||||
"META-INF/LICENSE.md",
|
||||
"META-INF/LICENSE.txt",
|
||||
"META-INF/NOTICE",
|
||||
"META-INF/NOTICE.txt",
|
||||
"META-INF/license.txt",
|
||||
"META-INF/notice.txt"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allOpen {
|
||||
|
|
Loading…
Reference in New Issue