From 5d634205d218b0900e2b53c6ed09acb70c54352e Mon Sep 17 00:00:00 2001 From: itorod Date: Thu, 21 Aug 2025 11:44:53 +0100 Subject: [PATCH 1/2] feat: Add task to run each example file --- .gitignore | 1 + examples/build.gradle.kts | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index e869293..80f5549 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ bdk.kt libbdkffi.dylib /.idea .DS_Store +/examples/data/ diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index f52e4d1..715ae7f 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { kotlin("jvm") version "2.1.10" + application } group = "org.bitcoindevkit" @@ -32,3 +33,17 @@ tasks.withType { jvmTarget.set(JvmTarget.JVM_11) } } + +tasks.register("WalletSetupBip32") { + group = "application" + description = "Runs the main function in the WalletSetupBip32 example" + mainClass.set("org.bitcoindevkit.WalletSetupBip32Kt") + classpath = sourceSets["main"].runtimeClasspath +} + +tasks.register("MultisigTransaction") { + group = "application" + description = "Runs the main function in the MultisigTransaction example" + mainClass.set("org.bitcoindevkit.MultisigTransactionKt") + classpath = sourceSets["main"].runtimeClasspath +} From c13a6811fe6929f690de1ea088b4bb2671bd3a37 Mon Sep 17 00:00:00 2001 From: itorod Date: Thu, 21 Aug 2025 11:45:39 +0100 Subject: [PATCH 2/2] docs: Show how to run examples in readme --- README.md | 14 ++++++++++++++ examples/build.gradle.kts | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a5c9c9b..aa0ebb1 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,20 @@ sdk install java 17.0.2-tem ```sh bash ./scripts/build-.sh ``` +## Run example files + +The `examples` module show different samples of how some of the APIs can be used. You can run the examples after building as stated above. The gradle task to run is by convention the file name of the example file. + +```shell +cd bdk-jvm +./gradlew MultisigTransaction +``` + +You can also list the application tasks. (All examples grouped under application) +```shell +cd bdk-jvm +./gradlew tasks --group application +``` ## How to publish to your local Maven repo diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 715ae7f..7ba74a0 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -1,8 +1,8 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { - kotlin("jvm") version "2.1.10" - application + id("org.jetbrains.kotlin.jvm") version "2.1.10" + id("application") } group = "org.bitcoindevkit"