diff --git a/.github/workflows/publish-android.yaml b/.github/workflows/publish-android.yaml index 33a7a26d..284295c3 100644 --- a/.github/workflows/publish-android.yaml +++ b/.github/workflows/publish-android.yaml @@ -1,10 +1,6 @@ name: Publish bdk-android to Maven Central on: [workflow_dispatch] -# The default Android NDK on the ubuntu-22.04 image is 25.2.9519653 -env: - ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/25.2.9519653 - jobs: build: runs-on: ubuntu-20.04 diff --git a/bdk-android/build.gradle.kts b/bdk-android/build.gradle.kts index c4659135..00c0beaa 100644 --- a/bdk-android/build.gradle.kts +++ b/bdk-android/build.gradle.kts @@ -1,14 +1,9 @@ -buildscript { - repositories { - google() - } - dependencies { - classpath("com.android.tools.build:gradle:7.1.2") - } -} - plugins { - id("io.github.gradle-nexus.publish-plugin") version "1.1.0" + id("com.android.library").version("8.3.1").apply(false) + id("org.jetbrains.kotlin.android").version("1.9.23").apply(false) + id("org.gradle.maven-publish") + id("org.gradle.signing") + id("io.github.gradle-nexus.publish-plugin").version("1.1.0").apply(true) } // library version is defined in gradle.properties diff --git a/bdk-android/gradle/wrapper/gradle-wrapper.properties b/bdk-android/gradle/wrapper/gradle-wrapper.properties index d2880ba8..d951fac2 100644 --- a/bdk-android/gradle/wrapper/gradle-wrapper.properties +++ b/bdk-android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/bdk-android/lib/build.gradle.kts b/bdk-android/lib/build.gradle.kts index f194df7e..f7267d5c 100644 --- a/bdk-android/lib/build.gradle.kts +++ b/bdk-android/lib/build.gradle.kts @@ -1,29 +1,24 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -// library version is defined in gradle.properties -val libraryVersion: String by project - plugins { id("com.android.library") - id("org.jetbrains.kotlin.android") version "1.9.23" - id("maven-publish") - id("signing") + id("org.jetbrains.kotlin.android") + id("org.gradle.maven-publish") + id("org.gradle.signing") // Custom plugin to generate the native libs and bindings file id("org.bitcoindevkit.plugins.generate-android-bindings") } -repositories { - mavenCentral() - google() -} +// library version is defined in gradle.properties +val libraryVersion: String by project android { - compileSdk = 31 + namespace = "org.bitcoindevkit" + compileSdk = 34 defaultConfig { - minSdk = 21 - targetSdk = 31 + minSdk = 24 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") } @@ -43,6 +38,20 @@ android { } } +kotlin { + tasks.withType().configureEach { + kotlinOptions { + jvmTarget = "17" + } + } +} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + dependencies { implementation("net.java.dev.jna:jna:5.14.0@aar") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7") @@ -103,6 +112,10 @@ afterEvaluate { } signing { + if (project.hasProperty("localBuild")) { + isRequired = false + } + val signingKeyId: String? by project val signingKey: String? by project val signingPassword: String? by project @@ -115,3 +128,9 @@ signing { tasks.withType { dependsOn("buildAndroidLib") } + +afterEvaluate { + tasks.named("mergeReleaseJniLibFolders") { + mustRunAfter(tasks.named("moveNativeAndroidLibs")) + } +} diff --git a/bdk-android/settings.gradle.kts b/bdk-android/settings.gradle.kts index ef7d1eb2..cf43879b 100644 --- a/bdk-android/settings.gradle.kts +++ b/bdk-android/settings.gradle.kts @@ -2,3 +2,17 @@ rootProject.name = "bdk-android" include(":lib") includeBuild("plugins") + +pluginManagement { + repositories { + gradlePluginPortal() + google() + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + google() + } +}