Rename kotlin package to org.bitcoindevkit, rust lib to bdkffi

This commit is contained in:
Steve Myers 2021-11-01 19:07:27 -07:00
parent fa1c6ffa33
commit a8f69fbd2b
9 changed files with 31 additions and 18 deletions

View File

@ -1,5 +1,5 @@
[package] [package]
name = "uniffi_bdk" name = "bdk-ffi"
version = "0.1.0" version = "0.1.0"
authors = ["Steve Myers <steve@notmandatory.org>", "Sudarsan Balaji <sudarsan.balaji@artfuldev.com>"] authors = ["Steve Myers <steve@notmandatory.org>", "Sudarsan Balaji <sudarsan.balaji@artfuldev.com>"]
edition = "2018" edition = "2018"
@ -7,6 +7,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib] [lib]
crate-type = ["staticlib", "cdylib"] crate-type = ["staticlib", "cdylib"]
name = "bdkffi"
[dependencies] [dependencies]
bdk = { version = "0.13", features = ["all-keys", "use-esplora-ureq"] } bdk = { version = "0.13", features = ["all-keys", "use-esplora-ureq"] }

View File

@ -33,7 +33,7 @@ afterEvaluate {
from components.release from components.release
// You can then customize attributes of the publication as shown below. // You can then customize attributes of the publication as shown below.
groupId = 'uniffi.bdk' groupId = 'org.bitcoindevkit'
artifactId = 'bdk' artifactId = 'bdk'
version = '0.0.1-SNAPSHOT' version = '0.0.1-SNAPSHOT'
} }
@ -42,7 +42,7 @@ afterEvaluate {
// Applies the component for the debug build variant. // Applies the component for the debug build variant.
from components.debug from components.debug
groupId = 'uniffi.bdk' groupId = 'org.bitcoindevkit'
artifactId = 'bdk-debug' artifactId = 'bdk-debug'
version = '0.0.1-SNAPSHOT' version = '0.0.1-SNAPSHOT'
} }

View File

@ -1,4 +1,4 @@
package uniffi.bdk package org.bitcoindevkit
import android.app.Application import android.app.Application
import android.content.Context.MODE_PRIVATE import android.content.Context.MODE_PRIVATE

View File

@ -3,7 +3,7 @@ plugins {
id 'application' id 'application'
} }
group = 'uniffi.bdk' group = 'org.bitcoindevkit.bdk'
version = '1.0-SNAPSHOT' version = '1.0-SNAPSHOT'
repositories { repositories {

View File

@ -1,6 +1,6 @@
import java.util.Optional import java.util.Optional
import kotlin.ExperimentalUnsignedTypes import kotlin.ExperimentalUnsignedTypes
import uniffi.bdk.* import org.bitcoindevkit.*
class LogProgress : BdkProgress { class LogProgress : BdkProgress {
override fun update(progress: Float, message: String?) { override fun update(progress: Float, message: String?) {

View File

@ -1,4 +1,4 @@
package org.bitcoindevkit.bdk package org.bitcoindevkit
import java.nio.file.Files import java.nio.file.Files

View File

@ -1,10 +1,10 @@
package org.bitcoindevkit.bdk package org.bitcoindevkit
import org.junit.Assert.* import org.junit.Assert.*
import org.junit.Test import org.junit.Test
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import uniffi.bdk.* import org.bitcoindevkit.*
import java.io.File import java.io.File
/** /**

View File

@ -7,7 +7,7 @@ set -eo pipefail
help() help()
{ {
# Display Help # Display Help
echo "Build bdk-uniffi and related libraries." echo "Build bdk-ffi and related libraries."
echo echo
echo "Syntax: build [-a|h|k|s]" echo "Syntax: build [-a|h|k|s]"
echo "options:" echo "options:"
@ -33,12 +33,12 @@ copy_lib_kotlin() {
"Darwin") "Darwin")
echo -n "darwin " echo -n "darwin "
mkdir -p bindings/bdk-kotlin/jvm/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/jvm/src/main/resources/darwin-x86-64 cp target/debug/libbdkffi.dylib bindings/bdk-kotlin/jvm/src/main/resources/darwin-x86-64
;; ;;
"Linux") "Linux")
echo -n "linux " echo -n "linux "
mkdir -p bindings/bdk-kotlin/jvm/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/jvm/src/main/resources/linux-x86-64 cp target/debug/libbdkffi.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"
@ -53,10 +53,10 @@ build_kotlin() {
## bdk swift ## bdk swift
build_swift() { build_swift() {
uniffi-bindgen generate src/bdk.udl --no-format --out-dir bindings/bdk-swift/ --language swift uniffi-bindgen generate src/bdk.udl --no-format --out-dir bindings/bdk-swift/ --language swift
swiftc -module-name bdk -emit-library -o libuniffi_bdk.dylib -emit-module -emit-module-path ./bindings/bdk-swift/ -parse-as-library -L ./target/debug/ -luniffi_bdk -Xcc -fmodule-map-file=./bindings/bdk-swift/bdkFFI.modulemap ./bindings/bdk-swift/bdk.swift swiftc -module-name bdk -emit-library -o libbdkffi.dylib -emit-module -emit-module-path ./bindings/bdk-swift/ -parse-as-library -L ./target/debug/ -lbdkffi -Xcc -fmodule-map-file=./bindings/bdk-swift/bdkFFI.modulemap ./bindings/bdk-swift/bdk.swift
TARGETDIR=target TARGETDIR=target
RELDIR=debug RELDIR=debug
STATIC_LIB_NAME=libuniffi_bdk.a STATIC_LIB_NAME=libbdkffi.a
# We can't use cargo lipo because we can't link to universal libraries :( # We can't use cargo lipo because we can't link to universal libraries :(
# https://github.com/rust-lang/rust/issues/55235 # https://github.com/rust-lang/rust/issues/55235
@ -106,19 +106,19 @@ build_android() {
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/libuniffi_bdk.so bindings/bdk-kotlin/android/src/main/jniLibs/arm64-v8a cp target/aarch64-linux-android/debug/libbdkffi.so bindings/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/libuniffi_bdk.so bindings/bdk-kotlin/android/src/main/jniLibs/x86_64 cp target/x86_64-linux-android/debug/libbdkffi.so bindings/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/libuniffi_bdk.so bindings/bdk-kotlin/android/src/main/jniLibs/armeabi-v7a cp target/armv7-linux-androideabi/debug/libbdkffi.so bindings/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/libuniffi_bdk.so bindings/bdk-kotlin/android/src/main/jniLibs/x86 cp target/i686-linux-android/debug/libbdkffi.so bindings/bdk-kotlin/android/src/main/jniLibs/x86
fi fi
# copy sources # copy sources

12
uniffi.toml Normal file
View File

@ -0,0 +1,12 @@
[bindings.kotlin]
package_name = "org.bitcoindevkit"
cdylib_name = "bdkffi"
[bindings.python]
cdylib_name = "bdkffi"
[bindings.ruby]
cdylib_name = "bdkffi"
[bindings.swift]
cdylib_name = "bdkffi"