Repository: bitcoindevkit/bdk-ffi (language: python)

Issue:
Build JVM and Android libs tasks do not run as part of the standard build process
### Description

Currently, when running tests directly from CLI or an IDE, we don't execute `buildJvmLib` and `buildAndroidLib` tasks automatically. Usually codegen-like tasks similar to `buildJvmLib` and `buildAndroidLib` are executed automatically before `assemble` task is executed, it would be nice to set that up for this project as well.

Pros:
1. No need to manually run `buildJvmLib` or `buildAndroidLib` when building project (which happens as part of running tests for example)
2. Easier to develop when making changes to bindings as they changes will be picked up automatically which avoids manually running `buildJvmLib` and `buildAndroidLib`.

Cons:
1. I didn't get a chance to test that out but it would be good that `buildJvmLib` and `buildAndroidLib` tasks can be cachable to avoid unnecessary execution, since we would be trying to run the task on each build.

### How to Reproduce

Steps:
1. Delete generated bindings in `jvm/src/main/kotlin/org/bitcoindevkit`
2. Run `./gradlew :jvm:test`
3. Fails since native bindings were not auto generated, requires manually running `buildJvmLib`
4. Same for the `:android` project

### Expected Result

The custom `buildJvmLib` and `buildAndroidLib` tasks are executed automatically when assembling `:jvm` and `:android` projects.

### Version

Latest `0.8.0-SNAPSHOT`.

### Artifact

- [X] bdk-jvm
- [X] bdk-android

### Platform

- [ ] ARM64 Android
- [ ] 64-bit x86 Android
- [ ] 32-bit x86 Android
- [ ] 64-bit x86 Linux (kernel 2.6.32+, glibc 2.11+)
- [ ] 64-bit x86 macOS (10.7+, Lion+)
- [ ] ARM64 macOS (11.0+, Big Sur+)

### Relevant log output

_No response_


Discussion / hints:
One potential solution is to make `KotlinCompile` task depend on `buildJvmLib`/`buildAndroidLib`:

```kotlin
// jvm/build.gradle.kts
tasks.withType<KotlinCompile> {
  dependsOn("buildJvmLib")
}

// android/build.gradle.kts
tasks.withType<KotlinCompile> {
  dependsOn("buildAndroidLib")
}
```
Concept ACK, sounds like a good idea. The `buildJvmLib` and `buildAndroidLib` won't rebuild anything if there were no changes to the `bdk-ffi` submodule, so shouldn't slow things down running them multiple times.
Agreed. @kirillzh do you want to take this on? If indeed your proposed solution works it will be an easy merge.

Fix patch:
diff --git a/bdk-android/lib/build.gradle.kts b/bdk-android/lib/build.gradle.kts
index 00b5cd92..3ebe1132 100644
--- a/bdk-android/lib/build.gradle.kts
+++ b/bdk-android/lib/build.gradle.kts
@@ -1,3 +1,5 @@
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
 // library version is defined in gradle.properties
 val libraryVersion: String by project
 
@@ -107,3 +109,9 @@ signing {
     useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
     sign(publishing.publications)
 }
+
+// This task dependency ensures that we build the bindings
+// binaries before running the tests
+tasks.withType<KotlinCompile> {
+    dependsOn("buildAndroidLib")
+}
diff --git a/bdk-jvm/lib/build.gradle.kts b/bdk-jvm/lib/build.gradle.kts
index 53a6f1f1..713b1cf6 100644
--- a/bdk-jvm/lib/build.gradle.kts
+++ b/bdk-jvm/lib/build.gradle.kts
@@ -1,5 +1,6 @@
 import org.gradle.api.tasks.testing.logging.TestExceptionFormat.*
 import org.gradle.api.tasks.testing.logging.TestLogEvent.*
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
 // library version is defined in gradle.properties
 val libraryVersion: String by project
@@ -101,3 +102,9 @@ signing {
     useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
     sign(publishing.publications)
 }
+
+// This task dependency ensures that we build the bindings
+// binaries before running the tests
+tasks.withType<KotlinCompile> {
+    dependsOn("buildJvmLib")
+}


Test patch:
diff --git a/.github/workflows/test-android.yaml b/.github/workflows/test-android.yaml
index 5083f57f..0544aab4 100644
--- a/.github/workflows/test-android.yaml
+++ b/.github/workflows/test-android.yaml
@@ -46,11 +46,6 @@ jobs:
       - name: Install rust android targets
         run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
 
-      - name: Build bdk-android library
-        run: |
-          cd bdk-android
-          ./gradlew buildAndroidLib
-
       - name: Run Android tests
         run: |
           cd bdk-android
diff --git a/.github/workflows/test-jvm.yaml b/.github/workflows/test-jvm.yaml
index 9116887f..ceb2597a 100644
--- a/.github/workflows/test-jvm.yaml
+++ b/.github/workflows/test-jvm.yaml
@@ -31,11 +31,6 @@ jobs:
           distribution: temurin
           java-version: 11
 
-      - name: Build bdk-jvm library
-        run: |
-          cd bdk-jvm
-          ./gradlew buildJvmLib
-
       - name: Run JVM tests
         run: |
           cd bdk-jvm