Skip to content

Commit 7dc1b50

Browse files
ADFA-6246 | Move the plugins to AGP 9.3.1 / Gradle 9.6.1 / Kotlin 2.3.21 (#108)
* chore(ADFA-6246): move the plugin toolchain to AGP 9.3.1 / Gradle 9.6.1 / Kotlin 2.3.21 Code On the Go ships AGP 9.3.1, Gradle 9.6.1 and Kotlin 2.3.21 (org.adfa.constants), so the standard these plugins track moves with it. scripts/check-toolchain.sh holds the numbers and gates every PR; its header is re-grounded on CoGo stage c263653bcf. AGP 9 compiles Kotlin itself and refuses org.jetbrains.kotlin.android, so that plugin is dropped from every module and Kotlin is pinned on the buildscript classpath in settings.gradle.kts instead, which is where AGP 9 takes its compiler from. The check also skips the gitignored .cache/ clone that update-libs.sh creates. CI never sees it, but locally it reported dozens of failures against a tree that is not ours to hold to this standard. * fix(ADFA-6246): build the asset-downloading and LiteRT plugins under Gradle 9 Gradle 9 turns an undeclared task dependency into a hard error. AI-Literacy-Course and NDK-Installer download their archives into src/main/assets, which more than one task then reads, so ordering only mergeAssets after the download moves the failure to the next consumer rather than fixing it -- the lint model task reads the same directory. Order every other task after the producers instead. mustRunAfter, not dependsOn: a bare assemblePlugin must keep failing loudly on a missing archive rather than quietly fetching 110 MB, which is the behaviour the guard below it exists to enforce. Sketch-to-UI: litert-support:1.0.1 is a 587-byte alias AAR with no classes whose manifest declares the same namespace as litert-support-api, and AGP 9 fails the manifest merge on the duplicate. Depend on litert-support-api, which carries all 75 classes. * fix(ADFA-6246): build the PCF templates under AGP 9's built-in Kotlin The same conversion ADFA-6180 made to the NDK template. PCFExample dropped the kotlin("android") plugin request AGP 9 refuses, pins the Kotlin stdlib to KOTLIN_VERSION rather than 1.9.22, and moves jvmTarget off the removed kotlinOptions DSL. PCFBuilder's root build was the older shape: a version catalog pinning AGP 8.10.1 and Kotlin 2.0.21 by hand, neither tracking the host. It becomes a .peb on AGP_VERSION like every other template, so it follows Code On the Go instead of drifting, and the catalog -- referenced by nothing once the plugin aliases are gone -- is deleted rather than left as a stale number to grep. Its wrapper also pinned Gradle 8.11.1 literally; it now takes GRADLE_VERSION. * fix(ADFA-6246): generate templates in the AGP 9 shape Project-to-Template rewrote the user's Kotlin plugin line as kotlin("android") version "${{KOTLIN_VERSION}}", so every template it produced declared the one plugin AGP 9 refuses. The build stayed green here and broke in the user's hands, on the generated project. Drop the line instead, and pin the Kotlin Gradle plugin on the generated root build's buildscript classpath, matching the core templates and what ADFA-6180 did to the NDK one. The LANGUAGE conditional went with it: it only ever wrapped that plugin line. The test asserts on generated file contents, which needs the real org.json -- the android.jar stub returns null under isReturnDefaultValues, which is why the existing test only exercises the dry-run path. Reverting the fix fails the new test on exactly its kotlin("android") assertion. * docs(ADFA-6246): drop the Kotlin plugin from the documented plugin shape CLAUDE.md still told plugin authors to apply org.jetbrains.kotlin.android, which AGP 9 rejects outright. --------- Co-authored-by: Daniel Alome <astrocoder007@gmail.com>
1 parent 2480ff9 commit 7dc1b50

95 files changed

Lines changed: 280 additions & 235 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CLAUDE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ say so in a comment.
8686

8787
A plugin is an Android *application* module (despite installing as a library) with:
8888

89-
1. **`build.gradle.kts`** applies `com.android.application`, `org.jetbrains.kotlin.android`, and `com.itsaky.androidide.plugins.build`. Configures `pluginBuilder { pluginName = "..." }`. Uses `compileOnly(files("../../libs/plugin-api.jar"))` — never `implementation`.
89+
1. **`build.gradle.kts`** applies `com.android.application` and `com.itsaky.androidide.plugins.build`. It must **not** apply `org.jetbrains.kotlin.android` — AGP 9 compiles Kotlin itself and refuses that plugin ("already on the classpath with an unknown version"); the Kotlin version is pinned on the buildscript classpath in `settings.gradle.kts` instead, which is where AGP 9 takes its compiler from. Configures `pluginBuilder { pluginName = "..." }`. Uses `compileOnly(files("../../libs/plugin-api.jar"))` — never `implementation`.
9090
2. **`settings.gradle.kts`** declares the jars it needs on the buildscript classpath plus AGP and Kotlin.
9191
3. **`src/main/AndroidManifest.xml`** declares plugin identity as `<meta-data>` entries on `<application>`: `plugin.id`, `plugin.name`, `plugin.version` (resolved from `${pluginVersion}`), `plugin.description`, `plugin.author`, `plugin.main_class`, `plugin.min_ide_version`, and optional `plugin.permissions`. Optionally `plugin.vcs_revision` / `plugin.build_timestamp` — see **Build provenance** below.
9292
4. **Main class** implements `com.itsaky.androidide.plugins.IPlugin`. Lifecycle: `initialize(PluginContext) → activate() → deactivate() → dispose()`. Services are obtained via `context.services.get(SomeService::class.java)` (e.g. `IdeBuildService` for build hooks). Android `Context` is `context.androidContext`.

‎cotg-ndk/build.gradle.kts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
22

33
plugins {
44
id("com.android.application")
5-
id("org.jetbrains.kotlin.android")
65
id("com.itsaky.androidide.plugins.build")
76
}
87

@@ -63,13 +62,13 @@ dependencies {
6362
implementation("androidx.appcompat:appcompat:1.6.1")
6463
implementation("com.google.android.material:material:1.10.0")
6564
implementation("androidx.fragment:fragment-ktx:1.8.8")
66-
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.3.0")
65+
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.3.21")
6766
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
6867
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
6968
}
7069

7170
tasks.wrapper {
72-
gradleVersion = "8.14.3"
71+
gradleVersion = "9.6.1"
7372
distributionType = Wrapper.DistributionType.BIN
7473
}
7574

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

‎cotg-ndk/settings.gradle.kts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ buildscript {
1414
dependencies {
1515
classpath(files("../libs/gradle-plugin.jar"))
1616
classpath(files("../libs/plugin-api.jar"))
17-
classpath("com.android.tools.build:gradle:8.11.0")
18-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.0")
17+
classpath("com.android.tools.build:gradle:9.3.1")
18+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.21")
1919
}
2020
}
2121

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

‎pebble-custom-function-template-installer/build.gradle.kts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
plugins {
22
id("com.android.application")
3-
id("org.jetbrains.kotlin.android")
43
id("com.itsaky.androidide.plugins.build")
54
}
65

@@ -52,7 +51,7 @@ dependencies {
5251
implementation("androidx.appcompat:appcompat:1.6.1")
5352
implementation("com.google.android.material:material:1.10.0")
5453
implementation("androidx.fragment:fragment-ktx:1.8.8")
55-
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.3.0")
54+
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.3.21")
5655
}
5756

5857
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
@@ -63,7 +62,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach
6362
}
6463

6564
tasks.wrapper {
66-
gradleVersion = "8.14.3"
65+
gradleVersion = "9.6.1"
6766
distributionType = Wrapper.DistributionType.BIN
6867
}
6968

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

‎pebble-custom-function-template-installer/settings.gradle.kts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ buildscript {
1414
dependencies {
1515
classpath(files("libs/plugin-api.jar"))
1616
classpath(files("libs/gradle-plugin.jar"))
17-
classpath("com.android.tools.build:gradle:8.11.0")
18-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.0")
17+
classpath("com.android.tools.build:gradle:9.3.1")
18+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.21")
1919
}
2020
}
2121

‎pebble-custom-function-template-installer/src/main/assets/templates/PCFBuilder/build.gradle.kts‎

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
buildscript {
3+
repositories {
4+
google()
5+
mavenCentral()
6+
}
7+
dependencies {
8+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${{KOTLIN_VERSION}}")
9+
}
10+
}
11+
12+
plugins {
13+
id("com.android.application") apply false version "${{AGP_VERSION}}"
14+
id("com.android.library") apply false version "${{AGP_VERSION}}"
15+
}

0 commit comments

Comments
 (0)