diff --git a/build.gradle b/build.gradle index 3ff7dc4..67a64e5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,25 +1,26 @@ +import cash.z.ecc.android.Deps + buildscript { - ext { - kotlin_version = '1.3.72' - } repositories { jcenter() } dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${Deps.kotlinVersion}" } } -apply plugin: 'java-library' -apply plugin: 'kotlin' +plugins { + id 'java-library' + id 'maven-publish' + id 'com.jfrog.bintray' version '1.8.5' + id "org.jetbrains.kotlin.jvm" version '1.3.72' + id 'org.jetbrains.dokka' version '0.10.1' +} -// jitpack (note: to change the version, push another release per https://jitpack.io/docs/#publishing-on-jitpack) -apply plugin: 'com.github.dcendents.android-maven' -group = 'com.github.zcash' +apply from: "publish.gradle" dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Deps.kotlinVersion}" } repositories { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..3d7a954 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` +} + +repositories { + jcenter() +} diff --git a/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt b/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt new file mode 100644 index 0000000..f998cad --- /dev/null +++ b/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt @@ -0,0 +1,18 @@ +package cash.z.ecc.android + +object Deps { + // For use in the top-level build.gradle which gives an error when provided + // `Deps.Kotlin.version` directly + const val kotlinVersion = "1.3.72" + const val group = "cash.z.ecc.android" + const val artifactName = "zcash-android-wallet-plugins" + const val versionName = "1.0.0" + const val description = "Lightweight dependency that makes it easier to plugin 3rd party implementations to the zcash Android SDK." + const val githubUrl = "https://github.com/zcash/zcash-android-wallet-plugins" + + object Kotlin : Version(kotlinVersion) { + val STDLIB = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version" + } +} + +open class Version(@JvmField val version: String) diff --git a/publish.gradle b/publish.gradle new file mode 100644 index 0000000..923727e --- /dev/null +++ b/publish.gradle @@ -0,0 +1,89 @@ +import cash.z.ecc.android.Deps + +///////////////////////////////////////// +// Publishing +///////////////////////////////////////// + +group = Deps.group +version = Deps.versionName + +// Create the pom configuration: +def pomConfig = { + licenses { + license { + name "MIT-style" + url "http://opensource.org/licenses/MIT" + distribution "repo" + } + } + developers { + developer { + id "gmale" + name "Kevin Gorham" + email "kevin.gorham@z.cash" + } + } + + scm { + url Deps.githubUrl + } +} + +// Jar containing Kotlin sources +task sourcesJar(type: Jar) { + archiveClassifier = 'sources' + from kotlin.sourceSets.main.kotlin.srcDirs +} + +// Jar containing docs +task docsJar(type: Jar) { + archiveClassifier = "javadoc" + group = JavaBasePlugin.DOCUMENTATION_GROUP + dependsOn dokka + from dokka +} + +publishing { + publications { + Production(MavenPublication) { + from components.java + artifact sourcesJar + artifact docsJar + groupId Deps.group + artifactId Deps.artifactName + version Deps.versionName + + pom.withXml { + def root = asNode() + root.appendNode('description', Deps.description) + root.appendNode('name', Deps.artifactName) + root.appendNode('url', ) + root.children().last() + pomConfig + } + } + } +} + +bintray { + user = project.hasProperty('bintrayUser') ?: System.getenv('BINTRAY_USER') + key = project.hasProperty('bintrayApiKey') ?: System.getenv('BINTRAY_API_KEY') + publications = ['Production'] + override = true + pkg { + repo = 'android' + name = Deps.artifactName + description = Deps.description + publish = true + publicDownloadNumbers = true + userOrg = 'ecc-mobile' + licenses = ['MIT'] + vcsUrl = Deps.githubUrl + dryRun = false + version { + name = Deps.versionName + desc = Deps.description + released = new Date() + vcsTag = this.version + } + } +}