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 ### Example Projects
#### `bdk-android` #### `bdk-android`
* [Devkit Wallet](https://github.com/thunderbiscuit/devkit-wallet) * [Devkit Wallet](https://github.com/thunderbiscuit/devkit-wallet)
* [Padawan Wallet](https://github.com/thunderbiscuit/padawan-wallet) * [Padawan Wallet](https://github.com/thunderbiscuit/padawan-wallet)
#### `bdk-jvm` #### `bdk-jvm`
* [Tatooine Faucet](https://github.com/thunderbiscuit/tatooine) * [Tatooine Faucet](https://github.com/thunderbiscuit/tatooine)
### How to build ### How to build
_Note that Kotlin version `1.6.10` or later is required to build the library._ _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 ```shell
git clone https://github.com/bitcoindevkit/bdk-kotlin git clone https://github.com/bitcoindevkit/bdk-kotlin
git submodule update --init git submodule update --init
``` ```
1. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions. 2. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions.
1. If building on MacOS install required intel and m1 jvm targets 3. If building on MacOS install required intel and m1 jvm targets
```sh ```sh
rustup target add x86_64-apple-darwin aarch64-apple-darwin rustup target add x86_64-apple-darwin aarch64-apple-darwin
``` ```
1. Install required targets 4. Install required targets
```sh ```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` 5. Install Android SDK and Build-Tools for API level 30+
```sh 6. Setup `$ANDROID_SDK_ROOT` and `$ANDROID_NDK_ROOT` path variables (which are required by the
cargo install uniffi_bindgen --version 0.16.0 build tool), for example (NDK major version 21 is required):
```
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):
```shell ```shell
export ANDROID_SDK_ROOT=~/Android/Sdk export ANDROID_SDK_ROOT=~/Android/Sdk
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.<NDK_VERSION> export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.<NDK_VERSION>
``` ```
1. Build kotlin bindings 7. Build kotlin bindings
```sh ```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 ```sh
./gradlew connectedAndroidTest ./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.keyName=<YOUR_GNUPG_ID>
signing.gnupg.passphrase=<YOUR_GNUPG_PASSPHRASE> signing.gnupg.passphrase=<YOUR_GNUPG_PASSPHRASE>
``` ```
1. Publish 2. Publish
```shell ```shell
./gradlew :jvm:publishToMavenLocal ./gradlew :jvm:publishToMavenLocal
./gradlew :android: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> ossrhUserName=<YOUR_SONATYPE_USERNAME>
ossrhPassword=<YOUR_SONATYPE_PASSWORD> ossrhPassword=<YOUR_SONATYPE_PASSWORD>
``` ```
1. Publish 2. Publish
```shell ```shell
./gradlew :jvm:publishToSonatype closeAndReleaseSonatypeStagingRepository ./gradlew :jvm:publishToSonatype closeAndReleaseSonatypeStagingRepository
./gradlew :android:publishToSonatype closeAndReleaseSonatypeStagingRepository ./gradlew :android:publishToSonatype closeAndReleaseSonatypeStagingRepository

View File

@ -1,16 +1,22 @@
# Readme # 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 ```kotlin
// bdk-jvm
plugins { 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: This aggregate task:
1. Builds the native JVM library (on your given platform) using `bdk-ffi` 1. Builds the native library(ies) using `bdk-ffi`
2. Places it in the correct resource directory 2. Places it in the correct resource directory
3. Builds the bindings file 3. Builds the bindings file

View File

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