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

111
README.md
View File

@ -46,66 +46,63 @@ 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):
``` ```shell
See the [UniFFI User Guide](https://mozilla.github.io/uniffi-rs/) for more info export ANDROID_SDK_ROOT=~/Android/Sdk
1. Install Android SDK and Build-Tools for API level 30+ export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.<NDK_VERSION>
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): 7. Build kotlin bindings
```shell ```sh
export ANDROID_SDK_ROOT=~/Android/Sdk # build JVM library
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.<NDK_VERSION> ./gradlew :jvm:buildJvmLib
```
1. Build kotlin bindings # build Android library
```sh ./gradlew :jvm:buildAndroidLib
./build.sh ```
``` 8. Start android emulator and run tests
1. Start android emulator and run tests ```sh
```sh ./gradlew connectedAndroidTest
./gradlew connectedAndroidTest ```
```
## How to publish ## How to publish
### Publish to your local maven repo ### Publish to your local maven repo
1. Set your `~/.gradle/gradle.properties` signing key values 1. Set your `~/.gradle/gradle.properties` signing key values
```properties ```properties
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
``` ```
Note that if you do not have gpg keys set up to sign the publication, the task will fail. If you wish to publish to your local Maven repository for local testing without signing the release, you can do so by excluding the `signMavenPublication` subtask like so: Note that if you do not have gpg keys set up to sign the publication, the task will fail. If you wish to publish to your local Maven repository for local testing without signing the release, you can do so by excluding the `signMavenPublication` subtask like so:
```shell ```shell
@ -116,18 +113,18 @@ Note that if you do not have gpg keys set up to sign the publication, the task w
### Publish to maven central with [Gradle Nexus Publish Plugin] (project maintainers only) ### Publish to maven central with [Gradle Nexus Publish Plugin] (project maintainers only)
1. Set your `~/.gradle/gradle.properties` signing key values and SONATYPE login 1. Set your `~/.gradle/gradle.properties` signing key values and SONATYPE login
```properties ```properties
signing.gnupg.keyName=<YOUR_GNUPG_ID> signing.gnupg.keyName=<YOUR_GNUPG_ID>
signing.gnupg.passphrase=<YOUR_GNUPG_PASSPHRASE> signing.gnupg.passphrase=<YOUR_GNUPG_PASSPHRASE>
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
``` ```
[Kotlin]: https://kotlinlang.org/ [Kotlin]: https://kotlinlang.org/
[Android Studio]: https://developer.android.com/studio/ [Android Studio]: https://developer.android.com/studio/

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'