diff --git a/build.gradle b/build.gradle index 571e785..67aa777 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,6 @@ import cash.z.ecc.android.Deps buildscript { -// ext.versionName = Versions.versionName -// ext.groupName = 'cash.z.ecc.android' - repositories { mavenLocal() google() @@ -12,6 +9,7 @@ buildscript { } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${Deps.kotlinVersion}" + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+' } } diff --git a/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt b/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt index f855d1f..bc81338 100644 --- a/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt +++ b/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt @@ -4,6 +4,9 @@ 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 versionName = "1.0.0-beta06" + const val description = "A concise implementation of BIP-0039 in Kotlin for Android." object Kotlin : Version(kotlinVersion) { val STDLIB = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version" @@ -17,7 +20,7 @@ object Deps { object Square : Version("1.9.2") { val MOSHI = "com.squareup.moshi:moshi:$version" - val MOSHI_KOTLIN = "com.squareup.moshi:moshi-kotlin:$version" + val MOSHI_KOTLIN = "com.squareup.moshi:moshi-kotlin:$version" } } diff --git a/lib/build.gradle b/lib/build.gradle index 1bbc107..9b6ade3 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -1,13 +1,13 @@ import cash.z.ecc.android.Deps plugins { + id 'maven-publish' + id 'com.jfrog.bintray' id "org.jetbrains.kotlin.jvm" + id 'org.jetbrains.dokka' version '0.10.1' id 'java-library' } -group = "cash.z.ecc.android" -version = "1.0.0-beta01" - tasks { compileKotlin { kotlinOptions { jvmTarget = 1.8 } @@ -17,6 +17,11 @@ tasks { kotlinOptions { jvmTarget = 1.8 } sourceCompatibility = 1.8 } + + // Generate Kotlin/Java documentation from sources. + dokka { + outputFormat = "html" + } } dependencies { implementation Deps.Kotlin.STDLIB @@ -42,3 +47,104 @@ test { sourceCompatibility = "8" targetCompatibility = "8" + + +///////////////////////////////////////// +// 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 "https://github.com/zcash/android-bip39" + } +} + + +// 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 +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + archiveClassifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives docsJar +} + +publishing { + publications { + Production(MavenPublication) { + from components.java + artifact sourcesJar + artifact docsJar + groupId Deps.group + artifactId "android-bip39" + version Deps.versionName + + pom.withXml { + def root = asNode() + root.appendNode('description', Deps.description) + root.appendNode('name', 'android-bip39') + root.appendNode('url', 'https://github.com/zcash/android-bip39') + root.children().last() + pomConfig + } + } + } +} + +bintray { + user = project.hasProperty('bintrayUser') ?: System.getenv('BINTRAY_USER') + key = project.hasProperty('bintrayApiKey') ?: System.getenv('BINTRAY_API_KEY') + publications = ['Production'] + configurations = ['archives'] + override = true + pkg { + repo = 'android-bip39' + name = 'android-bip39' + description = Deps.description + publish = true + publicDownloadNumbers = true + userOrg = 'ecc-mobile' + licenses = ['MIT'] + vcsUrl = 'https://github.com/zcash/android-bip39.git' + dryRun = false + version { + name = Deps.versionName + desc = "v${this.version}" + released = new Date() + vcsTag = this.version + } + } +} \ No newline at end of file