Configure publishing for jvm and android artifacts to maven central

This commit is contained in:
Steve Myers
2021-11-05 10:33:37 -07:00
parent 5512cee539
commit 62d7d6fbd5
5 changed files with 240 additions and 83 deletions

View File

@@ -1,8 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'
group = 'org.bitcoindevkit'
version = '0.1.0'
apply plugin: 'signing'
android {
compileSdkVersion 30
@@ -25,31 +24,13 @@ android {
}
}
afterEvaluate {
publishing {
repositories {
maven {
url myMavenRepoWriteUrl
}
}
publications {
maven(MavenPublication) {
from components.release
artifactId = 'bdk-android'
}
}
}
}
dependencies {
// implementation(project(':jvm')) {
// exclude group: 'net.java.dev.jna', module: 'jna'
// }
// api(project(':jvm')) {
// exclude group: 'net.java.dev.jna', module: 'jna'
// }
implementation 'net.java.dev.jna:jna:5.8.0@aar'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0'
@@ -57,12 +38,112 @@ dependencies {
api "org.slf4j:slf4j-api:1.7.30"
androidTestImplementation 'com.github.tony19:logback-android:2.0.0'
androidTestImplementation(testFixtures(project(':jvm'))) {
exclude group: 'net.java.dev.jna', module: 'jna'
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
// androidTestImplementation(testFixtures(project(':jvm'))) {
// exclude group: 'net.java.dev.jna', module: 'jna'
// exclude group: 'ch.qos.logback', module: 'logback-core'
// exclude group: 'ch.qos.logback', module: 'logback-classic'
// exclude group: 'junit', module: 'junit'
// }
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
}
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// You can then customize attributes of the publication as shown below.
groupId = 'org.bitcoindevkit'
artifactId = 'bdk-android'
version = '0.1.0'
// Applies the component for the release build variant.
from components.release
pom {
name = 'bdk-android'
description = 'Bitcoin Dev Kit Kotlin language bindings.'
url = "https://bitcoindevkit.org"
licenses {
license {
name = "APACHE"
url = "https://github.com/bitcoindevkit/bdk/blob/master/LICENSE-APACHE"
}
license {
name = "MIT"
url = "https://github.com/bitcoindevkit/bdk/blob/master/LICENSE-MIT"
}
}
developers {
developer {
id = 'notmandatory'
name = 'Steve Myers'
email = 'notmandatory@noreply.github.org'
}
developer {
id = 'artfuldev'
name = 'Sudarsan Balaji'
email = 'artfuldev@noreply.github.org'
}
}
scm {
connection = 'scm:git:github.com/bitcoindevkit/bdk-ffi.git'
developerConnection = 'scm:git:ssh://github.com/bitcoindevkit/bdk-ffi.git'
url = 'https://github.com/bitcoindevkit/bdk-ffi/tree/master'
}
}
}
// Creates a Maven publication called “debug”.
debug(MavenPublication) {
// Applies the component for the debug build variant.
from components.debug
groupId = 'org.bitcoindevkit'
artifactId = 'bdk-android-debug'
version = '0.1.0'
pom {
name = 'bdk-android-debug'
description = 'Bitcoin Dev Kit Kotlin language bindings.'
url = "https://bitcoindevkit.org"
licenses {
license {
name = "APACHE"
url = "https://github.com/bitcoindevkit/bdk/blob/master/LICENSE-APACHE"
}
license {
name = "MIT"
url = "https://github.com/bitcoindevkit/bdk/blob/master/LICENSE-MIT"
}
}
developers {
developer {
id = 'notmandatory'
name = 'Steve Myers'
email = 'notmandatory@noreply.github.org'
}
developer {
id = 'artfuldev'
name = 'Sudarsan Balaji'
email = 'artfuldev@noreply.github.org'
}
}
scm {
connection = 'scm:git:github.com/bitcoindevkit/bdk-ffi.git'
developerConnection = 'scm:git:ssh://github.com/bitcoindevkit/bdk-ffi.git'
url = 'https://github.com/bitcoindevkit/bdk-ffi/tree/master'
}
}
}
}
}
}
signing {
useGpgCmd()
sign publishing.publications
}

View File

@@ -11,11 +11,11 @@ import org.junit.runner.RunWith
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class AndroidLibTest : LibTest() {
override fun getTestDataDir(): String {
val context = ApplicationProvider.getApplicationContext<Application>()
return context.getDir("bdk-test", MODE_PRIVATE).toString()
}
}
//@RunWith(AndroidJUnit4::class)
//class AndroidLibTest : LibTest() {
// override fun getTestDataDir(): String {
// val context = ApplicationProvider.getApplicationContext<Application>()
// return context.getDir("bdk-test", MODE_PRIVATE).toString()
// }
//
//}