2021-10-11 23:04:18 -07:00
|
|
|
|
|
|
|
UniFFI
|
|
|
|
|
|
|
|
1. cargo install uniffi_bindgen
|
|
|
|
2. cargo build
|
2021-10-12 15:24:11 -07:00
|
|
|
3. uniffi-bindgen generate --no-format --out-dir bindings/bdk-kotlin/src/main/kotlin src/bdk.udl --language kotlin
|
|
|
|
4. cp target/debug/libuniffi_bdk.dylib bindings/bdk-kotlin/src/main/resources/darwin-x86-64
|
|
|
|
5. cd bindings/bdk-kotlin; gradle build -Djna.debug_load=true -Djna.debug_load.jna
|
2021-10-13 03:05:55 +05:30
|
|
|
|
2021-10-11 23:04:18 -07:00
|
|
|
|
2021-10-02 12:08:34 -07:00
|
|
|
Setup Android build environment
|
2021-06-30 17:44:46 -07:00
|
|
|
|
2021-09-25 21:17:40 -07:00
|
|
|
1. Add Android rust targets
|
|
|
|
|
|
|
|
```sh
|
|
|
|
rustup target add x86_64-apple-darwin x86_64-unknown-linux-gnu x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Set ANDROID_NDK_HOME
|
|
|
|
|
|
|
|
```sh
|
|
|
|
export ANDROID_NDK_HOME=/home/<user>/Android/Sdk/ndk/<NDK version, ie. 21.4.7075529>
|
|
|
|
```
|
2021-06-30 17:44:46 -07:00
|
|
|
|
2021-10-02 12:08:34 -07:00
|
|
|
Setup Swift build environment
|
|
|
|
|
|
|
|
1. Install Swift, see ["Download Swift"](https://swift.org/download/) page
|
|
|
|
|
2021-06-30 17:44:46 -07:00
|
|
|
Adding new structs and functions
|
|
|
|
|
|
|
|
1. Create C safe Rust structs and related functions using safer-ffi
|
|
|
|
|
|
|
|
2. Test generated library and `bdk_ffi.h` file with c language tests in `cc/bdk_ffi_test.c`
|
|
|
|
|
|
|
|
3. Use `build.sh` and `test.sh` to build c test program and verify functionality and
|
|
|
|
memory de-allocation via `valgrind`
|
|
|
|
|
|
|
|
4. Update the kotlin native interface LibJna.kt in the `bdk-kotlin` `jvm` module to match `bdk_ffi.h`
|
|
|
|
|
|
|
|
5. Create kotlin wrapper classes and interfaces as needed
|
|
|
|
|
|
|
|
6. Add tests to `bdk-kotlin` `test-fixtures` module
|
|
|
|
|
|
|
|
7. Use `build.sh` and `test.sh` to build and test `bdk-kotlin` `jvm` and `android` modules
|