Merge pull request #73 from bitcoindevkit/publish-a-package

Publish android and kotlin packages
This commit is contained in:
Sudarsan Balaji 2021-11-06 01:31:42 +05:30 committed by GitHub
commit 52529b7d05
5 changed files with 61 additions and 26 deletions

2
.gitignore vendored
View File

@ -15,3 +15,5 @@ local.properties
.DS_Store
testdb
xcuserdata
.lsp
.clj-kondo

View File

@ -11,7 +11,42 @@ for the rust library bdk for the Bitcoin Dev Kit (BDK) project.
| Kotlin | Android | WIP |
| Swift | iOS | WIP |
## Getting Started
## Getting Started (User)
If you just want to consume the language bindings:
### Kotlin (JVM)
1. Add the following maven repository location to your build file:
```
repositories {
maven {
url = uri("https://mymavenrepo.com/repo/hvZOau2SW1xzbycfC96m/")
}
}
```
1. Add the dependency
```
implementation("org.bitcoindevkit:bdk-jvm:0.1.0")
```
### Kotlin (Android)
1. Add the following maven repository location to your build file:
```
repositories {
maven {
url = uri("https://mymavenrepo.com/repo/hvZOau2SW1xzbycfC96m/")
}
}
```
1. Add the dependency
```
implementation("org.bitcoindevkit:bdk-android:0.1.0")
```
## Getting Started (Developer)
This project uses rust. A basic knowledge of the rust ecosystem is helpful.

View File

@ -1,6 +1,8 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'
group = 'org.bitcoindevkit'
version = '0.1.0'
android {
compileSdkVersion 30
@ -26,25 +28,18 @@ android {
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// Applies the component for the release build variant.
from components.release
// You can then customize attributes of the publication as shown below.
groupId = 'org.bitcoindevkit'
artifactId = 'bdk'
version = '0.0.1-SNAPSHOT'
repositories {
maven {
url myMavenRepoWriteUrl
}
// Creates a Maven publication called debug.
debug(MavenPublication) {
// Applies the component for the debug build variant.
from components.debug
}
groupId = 'org.bitcoindevkit'
artifactId = 'bdk-debug'
version = '0.0.1-SNAPSHOT'
publications {
maven(MavenPublication) {
from components.release
artifactId = 'bdk-android'
}
}
}

View File

@ -27,11 +27,18 @@ dependencies {
}
publishing {
repositories {
maven {
url myMavenRepoWriteUrl
}
}
publications {
maven(MavenPublication) {
groupId = 'org.bitcoindevkit'
artifactId = 'bdk'
version = '0.0.1-SNAPSHOT'
artifactId = 'bdk-jvm'
version = '0.1.0'
from components.java
}

View File

@ -100,9 +100,9 @@ build_android() {
export CFLAGS="-D__ANDROID_API__=21"
# IMPORTANT: make sure every target is not a substring of a different one. We check for them with grep later on
BUILD_TARGETS="${BUILD_TARGETS:-aarch64,armv7,x86_64,i686}"
BUILD_TARGETS="${BUILD_TARGETS:-aarch64,x86_64,i686}"
mkdir -p bindings/bdk-kotlin/android/src/main/jniLibs/ bindings/bdk-kotlin/android/src/main/jniLibs/arm64-v8a bindings/bdk-kotlin/android/src/main/jniLibs/x86_64 bindings/bdk-kotlin/android/src/main/jniLibs/armeabi-v7a bindings/bdk-kotlin/android/src/main/jniLibs/x86
mkdir -p bindings/bdk-kotlin/android/src/main/jniLibs/ bindings/bdk-kotlin/android/src/main/jniLibs/arm64-v8a bindings/bdk-kotlin/android/src/main/jniLibs/x86_64 bindings/bdk-kotlin/android/src/main/jniLibs/x86
if echo $BUILD_TARGETS | grep "aarch64"; then
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="aarch64-linux-android21-clang" CC="aarch64-linux-android21-clang" cargo build --target=aarch64-linux-android
@ -112,10 +112,6 @@ build_android() {
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER="x86_64-linux-android21-clang" CC="x86_64-linux-android21-clang" cargo build --target=x86_64-linux-android
cp target/x86_64-linux-android/debug/libbdkffi.so bindings/bdk-kotlin/android/src/main/jniLibs/x86_64
fi
if echo $BUILD_TARGETS | grep "armv7"; then
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="armv7a-linux-androideabi21-clang" CC="armv7a-linux-androideabi21-clang" cargo build --target=armv7-linux-androideabi
cp target/armv7-linux-androideabi/debug/libbdkffi.so bindings/bdk-kotlin/android/src/main/jniLibs/armeabi-v7a
fi
if echo $BUILD_TARGETS | grep "i686"; then
CARGO_TARGET_I686_LINUX_ANDROID_LINKER="i686-linux-android21-clang" CC="i686-linux-android21-clang" cargo build --target=i686-linux-android
cp target/i686-linux-android/debug/libbdkffi.so bindings/bdk-kotlin/android/src/main/jniLibs/x86
@ -125,7 +121,7 @@ build_android() {
cp -R bindings/bdk-kotlin/jvm/src/main/kotlin bindings/bdk-kotlin/android/src/main
# bdk-kotlin aar
(cd bindings/bdk-kotlin && ./gradlew :android:build && ./gradlew :android:publishToMavenLocal)
(cd bindings/bdk-kotlin && ./gradlew :android:build)
}
OS=$(uname)