Reorganize bdk-kotlin into jvm sub-module
This commit is contained in:
parent
c15c69fb08
commit
31db42ae0e
7
bindings/bdk-kotlin/.gitignore
vendored
Normal file
7
bindings/bdk-kotlin/.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/target
|
||||||
|
.idea
|
||||||
|
.gradle
|
||||||
|
local.properties
|
||||||
|
build
|
||||||
|
*.so
|
||||||
|
*.dylib
|
@ -1,42 +1,29 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.5.10'
|
ext.kotlin_version = '1.5.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
|
|
||||||
id 'java-library'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += [
|
freeCompilerArgs += [
|
||||||
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes",
|
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes",
|
||||||
]
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
task clean(type: Delete) {
|
||||||
implementation platform('org.jetbrains.kotlin:kotlin-bom')
|
delete rootProject.buildDir
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
implementation "net.java.dev.jna:jna:5.8.0"
|
|
||||||
implementation "junit:junit:4.13.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
}
|
||||||
|
39
bindings/bdk-kotlin/jvm/build.gradle
Normal file
39
bindings/bdk-kotlin/jvm/build.gradle
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.jetbrains.kotlin.jvm'
|
||||||
|
id 'java-library'
|
||||||
|
id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
testLogging {
|
||||||
|
events "PASSED", "SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation platform('org.jetbrains.kotlin:kotlin-bom')
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
implementation "net.java.dev.jna:jna:5.8.0"
|
||||||
|
implementation "junit:junit:4.13.2"
|
||||||
|
api "org.slf4j:slf4j-api:1.7.30"
|
||||||
|
testImplementation "ch.qos.logback:logback-classic:1.2.3"
|
||||||
|
testImplementation "ch.qos.logback:logback-core:1.2.3"
|
||||||
|
//testImplementation(project(':test-fixtures'))
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
maven(MavenPublication) {
|
||||||
|
groupId = 'org.bitcoindevkit'
|
||||||
|
artifactId = 'bdk'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
4
bindings/bdk-kotlin/settings.gradle
Normal file
4
bindings/bdk-kotlin/settings.gradle
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
rootProject.name = 'bdk-kotlin'
|
||||||
|
|
||||||
|
include ':jvm' //, ':android', ':test-fixtures'
|
||||||
|
|
24
build.sh
24
build.sh
@ -30,13 +30,13 @@ copy_lib_kotlin() {
|
|||||||
case $OS in
|
case $OS in
|
||||||
"Darwin")
|
"Darwin")
|
||||||
echo -n "darwin "
|
echo -n "darwin "
|
||||||
mkdir -p bindings/bdk-kotlin/src/main/resources/darwin-x86-64
|
mkdir -p bindings/bdk-kotlin/jvm/src/main/resources/darwin-x86-64
|
||||||
cp target/debug/libuniffi_bdk.dylib bindings/bdk-kotlin/src/main/resources/darwin-x86-64
|
cp target/debug/libuniffi_bdk.dylib bindings/bdk-kotlin/jvm/src/main/resources/darwin-x86-64
|
||||||
;;
|
;;
|
||||||
"Linux")
|
"Linux")
|
||||||
echo -n "linux "
|
echo -n "linux "
|
||||||
mkdir -p bindings/bdk-kotlin/src/main/resources/linux-x86-64
|
mkdir -p bindings/bdk-kotlin/jvm/src/main/resources/linux-x86-64
|
||||||
cp target/debug/libuniffi_bdk.so bindings/bdk-kotlin/src/main/resources/linux-x86-64
|
cp target/debug/libuniffi_bdk.so bindings/bdk-kotlin/jvm/src/main/resources/linux-x86-64
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
echo "libs to kotlin sub-project"
|
echo "libs to kotlin sub-project"
|
||||||
@ -44,7 +44,7 @@ copy_lib_kotlin() {
|
|||||||
|
|
||||||
## bdk-bdk-kotlin jar
|
## bdk-bdk-kotlin jar
|
||||||
build_kotlin() {
|
build_kotlin() {
|
||||||
uniffi-bindgen generate src/bdk.udl --no-format --out-dir bindings/bdk-kotlin/src/main/kotlin --language kotlin
|
uniffi-bindgen generate src/bdk.udl --no-format --out-dir bindings/bdk-kotlin/jvm/src/main/kotlin --language kotlin
|
||||||
}
|
}
|
||||||
|
|
||||||
## rust android
|
## rust android
|
||||||
@ -61,27 +61,27 @@ build_android() {
|
|||||||
# IMPORTANT: make sure every target is not a substring of a different one. We check for them with grep later on
|
# 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,armv7,x86_64,i686}"
|
||||||
|
|
||||||
mkdir -p bdk-bdk-kotlin/android/src/main/jniLibs/ bdk-bdk-kotlin/android/src/main/jniLibs/arm64-v8a bdk-bdk-kotlin/android/src/main/jniLibs/x86_64 bdk-bdk-kotlin/android/src/main/jniLibs/armeabi-v7a bdk-bdk-kotlin/android/src/main/jniLibs/x86
|
mkdir -p bdk-kotlin/android/src/main/jniLibs/ bdk-kotlin/android/src/main/jniLibs/arm64-v8a bdk-kotlin/android/src/main/jniLibs/x86_64 bdk-kotlin/android/src/main/jniLibs/armeabi-v7a bdk-kotlin/android/src/main/jniLibs/x86
|
||||||
|
|
||||||
if echo $BUILD_TARGETS | grep "aarch64"; then
|
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
|
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="aarch64-linux-android21-clang" CC="aarch64-linux-android21-clang" cargo build --target=aarch64-linux-android
|
||||||
cp target/aarch64-linux-android/debug/libbdk_ffi.so bdk-bdk-kotlin/android/src/main/jniLibs/arm64-v8a
|
cp target/aarch64-linux-android/debug/libbdk_ffi.so bdk-kotlin/android/src/main/jniLibs/arm64-v8a
|
||||||
fi
|
fi
|
||||||
if echo $BUILD_TARGETS | grep "x86_64"; then
|
if echo $BUILD_TARGETS | grep "x86_64"; then
|
||||||
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
|
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/libbdk_ffi.so bdk-bdk-kotlin/android/src/main/jniLibs/x86_64
|
cp target/x86_64-linux-android/debug/libbdk_ffi.so bdk-kotlin/android/src/main/jniLibs/x86_64
|
||||||
fi
|
fi
|
||||||
if echo $BUILD_TARGETS | grep "armv7"; then
|
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
|
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/libbdk_ffi.so bdk-bdk-kotlin/android/src/main/jniLibs/armeabi-v7a
|
cp target/armv7-linux-androideabi/debug/libbdk_ffi.so bdk-kotlin/android/src/main/jniLibs/armeabi-v7a
|
||||||
fi
|
fi
|
||||||
if echo $BUILD_TARGETS | grep "i686"; then
|
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
|
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/libbdk_ffi.so bdk-bdk-kotlin/android/src/main/jniLibs/x86
|
cp target/i686-linux-android/debug/libbdk_ffi.so bdk-kotlin/android/src/main/jniLibs/x86
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# bdk-bdk-kotlin aar
|
# bdk-kotlin aar
|
||||||
(cd bdk-bdk-kotlin && ./gradlew :android:build && ./gradlew :android:publishToMavenLocal)
|
(cd bdk-kotlin && ./gradlew :android:build && ./gradlew :android:publishToMavenLocal)
|
||||||
}
|
}
|
||||||
|
|
||||||
OS=$(uname)
|
OS=$(uname)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user