Clean up docs for custom Gradle plugins

This commit is contained in:
thunderbiscuit 2022-04-12 15:04:24 -04:00
parent 51f978e78e
commit 12e04a634b
No known key found for this signature in database
GPG Key ID: 88253696EB836462
3 changed files with 66 additions and 64 deletions

View File

@ -46,48 +46,45 @@ val newAddress = wallet.getNewAddress()
### Example Projects
#### `bdk-android`
* [Devkit Wallet](https://github.com/thunderbiscuit/devkit-wallet)
* [Padawan Wallet](https://github.com/thunderbiscuit/padawan-wallet)
#### `bdk-jvm`
* [Tatooine Faucet](https://github.com/thunderbiscuit/tatooine)
### How to build
_Note that Kotlin version `1.6.10` or later is required to build the library._
1. Clone this repository and init and update it's [`bdk-ffi`] submodule.
1. Clone this repository and initialize and update its [`bdk-ffi`] submodule.
```shell
git clone https://github.com/bitcoindevkit/bdk-kotlin
git submodule update --init
```
1. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions.
1. If building on MacOS install required intel and m1 jvm targets
2. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions.
3. If building on MacOS install required intel and m1 jvm targets
```sh
rustup target add x86_64-apple-darwin aarch64-apple-darwin
```
1. Install required targets
4. Install required targets
```sh
rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android
rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
```
1. Install `uniffi-bindgen`
```sh
cargo install uniffi_bindgen --version 0.16.0
```
See the [UniFFI User Guide](https://mozilla.github.io/uniffi-rs/) for more info
1. Install Android SDK and Build-Tools for API level 30+
1. Setup `$ANDROID_SDK_ROOT` and `$ANDROID_NDK_ROOT` path variables (which are required by the
build scripts), for example (NDK major version 21 is required):
5. Install Android SDK and Build-Tools for API level 30+
6. Setup `$ANDROID_SDK_ROOT` and `$ANDROID_NDK_ROOT` path variables (which are required by the
build tool), for example (NDK major version 21 is required):
```shell
export ANDROID_SDK_ROOT=~/Android/Sdk
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.<NDK_VERSION>
```
1. Build kotlin bindings
7. Build kotlin bindings
```sh
./build.sh
# build JVM library
./gradlew :jvm:buildJvmLib
# build Android library
./gradlew :jvm:buildAndroidLib
```
1. Start android emulator and run tests
8. Start android emulator and run tests
```sh
./gradlew connectedAndroidTest
```
@ -101,7 +98,7 @@ _Note that Kotlin version `1.6.10` or later is required to build the library._
signing.gnupg.keyName=<YOUR_GNUPG_ID>
signing.gnupg.passphrase=<YOUR_GNUPG_PASSPHRASE>
```
1. Publish
2. Publish
```shell
./gradlew :jvm:publishToMavenLocal
./gradlew :android:publishToMavenLocal
@ -123,7 +120,7 @@ Note that if you do not have gpg keys set up to sign the publication, the task w
ossrhUserName=<YOUR_SONATYPE_USERNAME>
ossrhPassword=<YOUR_SONATYPE_PASSWORD>
```
1. Publish
2. Publish
```shell
./gradlew :jvm:publishToSonatype closeAndReleaseSonatypeStagingRepository
./gradlew :android:publishToSonatype closeAndReleaseSonatypeStagingRepository

View File

@ -1,16 +1,22 @@
# Readme
The purpose of this directory is to host a Gradle plugin that adds tasks for building the native binaries required by bdk-jvm/ bdk-android and building the language bindings files.
The purpose of this directory is to host the Gradle plugins that add tasks for building the native binaries required by bdk-jvm and bdk-android, and building the language bindings files.
The plugin is applied to the specific `build.gradle.kts` files in `bdk-jvm` and `bdk-android` through the `plugins` block:
The plugins are applied to the specific `build.gradle.kts` files in `bdk-jvm` and `bdk-android` through the `plugins` block:
```kotlin
// bdk-jvm
plugins {
id("org.bitcoindevkit.plugin.generate-bdk-bindings")
id("org.bitcoindevkit.plugin.generate-jvm-bindings")
}
// bdk-android
plugins {
id("org.bitcoindevkit.plugins.generate-android-bindings")
}
```
It adds a series of tasks (`buildJvmBinary`, `moveNativeJvmLib`, `generateJvmBindings`) which are then brought together into an aggregate task called `buildJvmLib`.
They add a series of tasks which are brought together into an aggregate task called `buildJvmLib` for `bdk-jvm` and `buildAndroidLib` for `bdk-android`.
This task:
1. Builds the native JVM library (on your given platform) using `bdk-ffi`
This aggregate task:
1. Builds the native library(ies) using `bdk-ffi`
2. Places it in the correct resource directory
3. Builds the bindings file

View File

@ -1,4 +1,3 @@
rootProject.name = "bdk-kotlin"
include(":jvm", ":android")
//include 'buildSrc'