From 2a2bb9293c9a86a2817878223538483cec8a84bb Mon Sep 17 00:00:00 2001 From: Absinthe Date: Mon, 21 Sep 2026 10:49:57 +0800 Subject: [PATCH] Migrate to AGP 9.4.1 and Gradle 9.7.1 with built-in Kotlin --- README.md | 10 +++++----- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle | 17 +++++++---------- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 6d63251..df08d28 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,9 @@ Choose the coroutine context for `getRule(...)` in your app. ## JitPack JitPack builds with JDK 17 and publishes the library module through -`:library:publishToMavenLocal`. +`:library:publishToMavenLocal`. AGP 9.4 requires Gradle 9.6 or newer; use the +checked-in wrapper. Kotlin compilation uses AGP built-in support, with the +Kotlin Parcelize plugin declared separately. ## Bundled baseline and downloaded v5 data @@ -154,10 +156,8 @@ dependencies beyond Kotlin already used by the app. Rebuild this AAR after Bundl source changes. No publication or invented Maven version is required. A composite `includeBuild` substitution can work when the host uses a compatible -Gradle/AGP toolchain. It does **not** currently work with LibChecker's Gradle 9.7 / -AGP 9.4: Bundle's AGP 8.11 references Gradle internals removed in Gradle 9.6. -Use the separately built AAR for this host. Keep this repository's Gradle wrapper -for its standalone checks. Library code releases and Rules data releases are +Gradle/AGP toolchain. Use the separately built AAR for host integration checks +and this repository's Gradle wrapper for standalone checks. Library code releases and Rules data releases are independent. Build the library and test APK (JDK 17 for this standalone Gradle wrapper): diff --git a/build.gradle b/build.gradle index 72746bf..561d285 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file using plugins DSL plugins { - id 'com.android.library' version '8.13.2' apply false - id 'org.jetbrains.kotlin.android' version '2.4.20' apply false + id 'com.android.library' version '9.4.1' apply false + id 'org.jetbrains.kotlin.plugin.parcelize' version '2.4.20' apply false } tasks.register('clean', Delete) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 28b784d..e22e9a1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://downloads.gradle.org/distributions/gradle-8.14.5-bin.zip +distributionUrl=https\://downloads.gradle.org/distributions/gradle-9.7.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/library/build.gradle b/library/build.gradle index fd8dfa9..872e6a9 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,7 +1,6 @@ plugins { id 'com.android.library' - id 'org.jetbrains.kotlin.android' - id 'kotlin-parcelize' + id 'org.jetbrains.kotlin.plugin.parcelize' } apply from: "${rootDir.path}/gradle/publish.gradle" @@ -12,17 +11,12 @@ android { defaultConfig { minSdk = 21 - //noinspection OldTargetApi,EditedTargetSdkVersion - targetSdk = 34 - versionCode = 1 - versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled = false - shrinkResources = false proguardFiles 'proguard-rules.pro' } } @@ -38,9 +32,6 @@ android { targetCompatibility = JavaVersion.VERSION_11 } - kotlinOptions { - jvmTarget = '11' - } // Test real producer output without embedding a second copy in the library. if (project.hasProperty('rulesTestBundleDir')) { @@ -53,3 +44,9 @@ dependencies { androidTestImplementation 'androidx.test:runner:1.7.0' androidTestImplementation 'androidx.test.ext:junit:1.3.0' } + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 + } +}