Skip to content

Commit

Permalink
build: update android gradle plugin to 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Nov 8, 2024
1 parent 93bf63b commit f680f5b
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 29 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/publish-android.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -25,7 +21,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17

- name: "Set default Rust version to 1.77.1"
run: rustup default 1.77.1
Expand Down
15 changes: 5 additions & 10 deletions bdk-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion bdk-android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
45 changes: 32 additions & 13 deletions bdk-android/lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
}
Expand All @@ -43,6 +38,20 @@ android {
}
}

kotlin {
tasks.withType<KotlinCompile>().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")
Expand Down Expand Up @@ -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
Expand All @@ -115,3 +128,9 @@ signing {
tasks.withType<KotlinCompile> {
dependsOn("buildAndroidLib")
}

afterEvaluate {
tasks.named("mergeReleaseJniLibFolders") {
mustRunAfter(tasks.named("moveNativeAndroidLibs"))
}
}
14 changes: 14 additions & 0 deletions bdk-android/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,17 @@ rootProject.name = "bdk-android"

include(":lib")
includeBuild("plugins")

pluginManagement {
repositories {
gradlePluginPortal()
google()
}
}

dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}
}

0 comments on commit f680f5b

Please sign in to comment.