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 2c55667..713b0d3 100644 --- a/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt +++ b/buildSrc/src/main/java/cash/z/ecc/android/Dependencies.kt @@ -5,8 +5,10 @@ object Deps { // `Deps.Kotlin.version` directly const val kotlinVersion = "1.3.72" const val group = "cash.z.ecc.android" + const val artifactName = "kotlin-bip39" const val versionName = "1.0.0-beta08" const val description = "A concise implementation of BIP-0039 in Kotlin for Android." + const val githubUrl = "https://github.com/zcash/kotlin-bip39" object Kotlin : Version(kotlinVersion) { val STDLIB = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version" diff --git a/lib/build.gradle b/lib/build.gradle index 67aab3f..2151428 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -8,6 +8,8 @@ plugins { id 'java-library' } +apply from: "publish.gradle" + tasks { compileKotlin { kotlinOptions { jvmTarget = 1.8 } @@ -42,97 +44,7 @@ test { events = ["failed", "skipped"] showStandardStreams = true } - } 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/kotlin-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 -} - -publishing { - publications { - Production(MavenPublication) { - from components.java - artifact sourcesJar - artifact docsJar - groupId Deps.group - artifactId "kotlin-bip39" - version Deps.versionName - - pom.withXml { - def root = asNode() - root.appendNode('description', Deps.description) - root.appendNode('name', 'kotlin-bip39') - root.appendNode('url', 'https://github.com/zcash/kotlin-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'] - override = true - pkg { - repo = 'android' - name = 'kotlin-bip39' - description = Deps.description - publish = true - publicDownloadNumbers = true - userOrg = 'ecc-mobile' - licenses = ['MIT'] - vcsUrl = 'https://github.com/zcash/kotlin-bip39.git' - dryRun = true - version { - name = Deps.versionName - desc = Deps.description - released = new Date() - vcsTag = this.version - } - } -} \ No newline at end of file diff --git a/lib/publish.gradle b/lib/publish.gradle new file mode 100644 index 0000000..b6754f0 --- /dev/null +++ b/lib/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 = true + version { + name = Deps.versionName + desc = Deps.description + released = new Date() + vcsTag = this.version + } + } +}