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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import java.util.Optional
import kotlin.ExperimentalUnsignedTypes
import uniffi.bdk.*
import org.bitcoindevkit.*
class LogProgress : BdkProgress {
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

View File

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

View File

@ -7,7 +7,7 @@ set -eo pipefail
help()
{
# Display Help
echo "Build bdk-uniffi and related libraries."
echo "Build bdk-ffi and related libraries."
echo
echo "Syntax: build [-a|h|k|s]"
echo "options:"
@ -33,12 +33,12 @@ copy_lib_kotlin() {
"Darwin")
echo -n "darwin "
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")
echo -n "linux "
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
echo "libs to kotlin sub-project"
@ -53,10 +53,10 @@ build_kotlin() {
## bdk swift
build_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
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 :(
# https://github.com/rust-lang/rust/issues/55235
@ -106,19 +106,19 @@ build_android() {
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
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
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
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
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/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
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/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
# 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"