[#421] Maven Publish 0.20.0

This commit is contained in:
Carter Jernigan 2022-06-16 06:48:44 -04:00 committed by Carter Jernigan
parent 5ec79cc20d
commit 17c09908a8
4 changed files with 58 additions and 37 deletions

View File

@ -6,7 +6,6 @@ buildscript {
dependencies { dependencies {
classpath(kotlin("gradle-plugin", version = libs.versions.kotlin.get())) classpath(kotlin("gradle-plugin", version = libs.versions.kotlin.get()))
classpath(libs.gradle.plugin.rust) classpath(libs.gradle.plugin.rust)
classpath(libs.gradle.plugin.publish)
classpath(libs.gradle.plugin.navigation) classpath(libs.gradle.plugin.navigation)
} }
} }
@ -15,13 +14,9 @@ plugins {
id("com.github.ben-manes.versions") id("com.github.ben-manes.versions")
id("com.osacky.fulladle") id("com.osacky.fulladle")
id("io.gitlab.arturbosch.detekt") id("io.gitlab.arturbosch.detekt")
id("org.jetbrains.dokka")
id("org.owasp.dependencycheck")
id("zcash-sdk.ktlint-conventions") id("zcash-sdk.ktlint-conventions")
} }
apply(plugin = "com.vanniktech.maven.publish")
tasks { tasks {
register("detektAll", io.gitlab.arturbosch.detekt.Detekt::class) { register("detektAll", io.gitlab.arturbosch.detekt.Detekt::class) {
parallel = true parallel = true

View File

@ -17,23 +17,12 @@ mavenCentralPassword=
# Configures whether release is an unstable snapshot. # Configures whether release is an unstable snapshot.
IS_SNAPSHOT=true IS_SNAPSHOT=true
RELEASE_SIGNING_ENABLED=false
# Required by the maven publishing plugin
SONATYPE_HOST=DEFAULT
LIBRARY_VERSION=1.6.0-beta01 LIBRARY_VERSION=1.6.0-beta01
POM_NAME=Zcash Android Wallet SDK
GROUP=cash.z.ecc.android
POM_ARTIFACT_ID=zcash-android-sdk
POM_DESCRIPTION=This lightweight SDK connects Android to Zcash. It welds together Rust and Kotlin in a minimal way, allowing third-party Android apps to send and receive shielded transactions easily, securely and privately.
POM_INCEPTION_YEAR=2018
POM_URL=https://github.com/zcash/zcash-android-wallet-sdk/
POM_SCM_URL=https://github.com/zcash/zcash-android-wallet-sdk/
POM_SCM_CONNECTION=scm:git:git://github.com/zcash/zcash-android-wallet-sdk.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/zcash/zcash-android-wallet-sdk.git
POM_LICENCE_NAME=The MIT License
POM_LICENCE_URL=http://opensource.org/licenses/MIT
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=zcash
POM_DEVELOPER_NAME=Zcash
POM_DEVELOPER_URL=https://github.com/zcash/
# Kotlin compiler warnings can be considered errors, failing the build. # Kotlin compiler warnings can be considered errors, failing the build.
# Currently set to false, because this project has a lot of warnings to fix first. # Currently set to false, because this project has a lot of warnings to fix first.
@ -78,8 +67,7 @@ FULLADLE_VERSION=0.17.4
GRADLE_VERSIONS_PLUGIN_VERSION=0.42.0 GRADLE_VERSIONS_PLUGIN_VERSION=0.42.0
KTLINT_VERSION=0.45.2 KTLINT_VERSION=0.45.2
KSP_VERSION=1.6.21-1.0.6 KSP_VERSION=1.6.21-1.0.6
MAVEN_PUBLISH_GRADLE_PLUGIN=0.18.0 MAVEN_PUBLISH_GRADLE_PLUGIN=0.20.0
OWASP_DEPENDENCY_CHECK_VERSION=6.5.0.1
PROTOBUF_GRADLE_PLUGIN_VERSION=0.8.18 PROTOBUF_GRADLE_PLUGIN_VERSION=0.8.18
RUST_GRADLE_PLUGIN_VERSION=0.9.3 RUST_GRADLE_PLUGIN_VERSION=0.9.3

View File

@ -14,23 +14,25 @@ plugins {
id("org.jetbrains.dokka") id("org.jetbrains.dokka")
id("com.google.protobuf") id("com.google.protobuf")
id("org.mozilla.rust-android-gradle.rust-android") id("org.mozilla.rust-android-gradle.rust-android")
id("com.vanniktech.maven.publish") id("com.vanniktech.maven.publish.base")
} }
// Publishing information // Publishing information
val isSnapshot = project.property("IS_SNAPSHOT").toString().toBoolean() val isSnapshot = project.property("IS_SNAPSHOT").toString().toBoolean()
val version = project.property("LIBRARY_VERSION").toString() val version = project.property("LIBRARY_VERSION").toString()
val ARTIFACT_ID = project.property("POM_ARTIFACT_ID").toString()
project.group = "cash.z.ecc.android" project.group = "cash.z.ecc.android"
project.version = if (isSnapshot) { project.version = if (isSnapshot) {
"$version-SNAPSHOT" "$version-SNAPSHOT"
} else { } else {
version version
} }
val myArtifactId = "zcash-android-sdk"
publishing { publishing {
publications { publications {
publications.withType<MavenPublication>().all { publications.withType<MavenPublication>().all {
artifactId = ARTIFACT_ID artifactId = myArtifactId
} }
} }
} }
@ -73,7 +75,7 @@ android {
kotlinOptions { kotlinOptions {
// Tricky: fix: By default, the kotlin_module name will not include the version (in classes.jar/META-INF). Instead it has a colon, which breaks compilation on Windows. This is one way to set it explicitly to the proper value. See https://github.com/zcash/zcash-android-wallet-sdk/issues/222 for more info. // Tricky: fix: By default, the kotlin_module name will not include the version (in classes.jar/META-INF). Instead it has a colon, which breaks compilation on Windows. This is one way to set it explicitly to the proper value. See https://github.com/zcash/zcash-android-wallet-sdk/issues/222 for more info.
freeCompilerArgs += listOf("-module-name", "$ARTIFACT_ID-${project.version}_release") freeCompilerArgs += listOf("-module-name", "$myArtifactId-${project.version}_release")
} }
packagingOptions { packagingOptions {
@ -97,16 +99,53 @@ android {
baseline = File("lint-baseline.xml") baseline = File("lint-baseline.xml")
} }
publishing { // Handled by com.vanniktech.maven.publish.AndroidSingleVariantLibrary below
singleVariant("release") { // publishing {
withSourcesJar() // singleVariant("release") {
withJavadocJar() // withSourcesJar()
} // withJavadocJar()
} // }
// }
} }
mavenPublish { mavenPublishing {
androidVariantToPublish = "release" publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.DEFAULT)
signAllPublications()
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")
}
}
}
configure(
com.vanniktech.maven.publish.AndroidSingleVariantLibrary(
"release",
sourcesJar = true,
publishJavadocJar = true
)
)
} }
allOpen { allOpen {
@ -190,7 +229,6 @@ dependencies {
implementation(libs.bundles.grpc) implementation(libs.bundles.grpc)
compileOnly(libs.javax.annotation) compileOnly(libs.javax.annotation)
// //
// Locked Versions // Locked Versions
// these should be checked regularly and removed when possible // these should be checked regularly and removed when possible

View File

@ -14,7 +14,7 @@ pluginManagement {
val gradleVersionsPluginVersion = extra["GRADLE_VERSIONS_PLUGIN_VERSION"].toString() val gradleVersionsPluginVersion = extra["GRADLE_VERSIONS_PLUGIN_VERSION"].toString()
val kotlinVersion = extra["KOTLIN_VERSION"].toString() val kotlinVersion = extra["KOTLIN_VERSION"].toString()
val kspVersion = extra["KSP_VERSION"].toString() val kspVersion = extra["KSP_VERSION"].toString()
val owaspVersion = extra["OWASP_DEPENDENCY_CHECK_VERSION"].toString() val mavenPublishPluginVersion = extra["MAVEN_PUBLISH_GRADLE_PLUGIN"].toString()
val protobufVersion = extra["PROTOBUF_GRADLE_PLUGIN_VERSION"].toString() val protobufVersion = extra["PROTOBUF_GRADLE_PLUGIN_VERSION"].toString()
id("com.android.application") version (androidGradlePluginVersion) apply (false) id("com.android.application") version (androidGradlePluginVersion) apply (false)
@ -23,11 +23,11 @@ pluginManagement {
id("com.google.devtools.ksp") version(kspVersion) apply (false) id("com.google.devtools.ksp") version(kspVersion) apply (false)
id("com.google.protobuf") version (protobufVersion) apply (false) id("com.google.protobuf") version (protobufVersion) apply (false)
id("com.osacky.fulladle") version (fulladleVersion) apply (false) id("com.osacky.fulladle") version (fulladleVersion) apply (false)
id("com.vanniktech.maven.publish.base") version(mavenPublishPluginVersion) apply (false)
id("io.gitlab.arturbosch.detekt") version (detektVersion) apply (false) id("io.gitlab.arturbosch.detekt") version (detektVersion) apply (false)
id("org.jetbrains.dokka") version (dokkaVersion) apply (false) id("org.jetbrains.dokka") version (dokkaVersion) apply (false)
id("org.jetbrains.kotlin.android") version (kotlinVersion) apply (false) id("org.jetbrains.kotlin.android") version (kotlinVersion) apply (false)
id("org.jetbrains.kotlin.plugin.allopen") version (kotlinVersion) apply (false) id("org.jetbrains.kotlin.plugin.allopen") version (kotlinVersion) apply (false)
id("org.owasp.dependencycheck") version (owaspVersion) apply (false)
} }
} }