Skip to content

Toolchain migration: AGP 9, Gradle 9, built-in Kotlin, plugin upgrades - #20

Open
michelutke wants to merge 17 commits into
mainfrom
feature/toolchain-agp9
Open

Toolchain migration: AGP 9, Gradle 9, built-in Kotlin, plugin upgrades#20
michelutke wants to merge 17 commits into
mainfrom
feature/toolchain-agp9

Conversation

@michelutke

@michelutke michelutke commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Closes #16.

Why

  • Staying on AGP/Gradle 8.x accumulates migration debt; AGP 9 + Gradle 9 + built-in Kotlin is the current toolchain generation, and consumer-facing artifacts should ship from a maintained stack.
  • AGP 9 removes support for the setups we were on: com.android.library + kotlin.multiplatform, the standalone kotlin.android plugin, and app+KMP single modules — so this is a hard prerequisite for any future toolchain work.
  • Unblocks the loco plugin 1.x line (locoFetch/locoPush) — push previously required the standalone CLI or manual dashboard work.
  • Deliberately its own milestone, NOT part of 2.0.0 (which was device-verified on AGP 8.13); Kotlin stays 2.2.21 so the minimum consumer Kotlin (2.1.0) does not move.

What

  • Gradle 8.13 → 9.6.1, AGP 8.13.0 → 9.3.1 (catalog alias gradleagp); obsolete flags removed (jetifier, useAndroidX), base plugin dropped, library targetSdk removed.
  • :updraft-core / :updraft-ui-compose → new com.android.kotlin.multiplatform.library target plugin, with withHostTestBuilder {} (Android host tests live on as testAndroidHostTest, 18+12 green) and androidResources { enable = true } (compose resources stay packaged — CMP-9547).
  • :updraft-sdk → AGP 9 built-in Kotlin (no more kotlin.android plugin; top-level kotlin { compilerOptions {} }).
  • Sample split: sample/composeApp is now a shared KMP library; new thin sample/androidApp carries applicationId/signing/manifest (pure file renames). AGP 9 forbids com.android.application + kotlin.multiplatform in one module. sample/iosApp untouched.
  • Plugin/dep upgrades: maven-publish 0.37.0 · dokka 2.2.0 · androidx.startup 1.2.0 · coveralls 2.12.2 (kept, still unused) · updraft 3.0.0 (AGP 9-compatible line; 2.x crashes under AGP 9) · loco 1.2.0 (updateLocolocoFetch/locoPush; rename updraft.locoApiKeylocoApiKey in your local.properties) · CMP 1.10.3 (not 1.11.x — its iOS klibs need Kotlin ≥ 2.3).
  • Publish workflows: verify step re-pointed at the renamed test tasks (testDebugUnitTesttestAndroidHostTest).

How

  • Staged, bisectable commits: baseline capture → pre-cleanup on 8.13 → Gradle/AGP core bump → built-in Kotlin → per-module KMP plugin migration → sample split → plugin upgrades → docs/CI. Migration follows the official guides (Kotlin AGP-9 migration guide, Android built-in-Kotlin docs).
  • Artifact-parity proof: publishToMavenLocal snapshot diffed before/after — file set, POM dependency chains, .module variant dependencies and compose-resource aar contents identical. Accepted metadata deltas (documented): variant names release*android*Elements (+libraryelements attribute; attribute contract intact), dropped kotlin-*-common POM exclusions (empty stubs since Kotlin 1.8), deliberate dependency bumps, toolchain stamps.
  • Consumer smoke test: throwaway app on AGP 8.13 / Kotlin 2.1.0 resolves and compiles updraft-sdk:2.0.0 from mavenLocal; resolved graph verified free of kotlin-*-common stubs — Kotlin floor unchanged.
  • CI: android + iOS jobs green, plus a green Verify publish (dry run) on this branch; locoFetch round-trip clean.

Manual merge gates (pending — do not merge before)

  • Android device pass: hint → shake → annotate → send → dashboard; update dialog
  • iOS simulator pass: shake → feedback UI
  • locoPush dry-run (full-access key)

Follow-ups (not in this PR)

  • Kotlin ≥ 2.3 bump + CMP 1.11.x (raises min consumer Kotlin — release-notes impact)
  • Backlog: updraft-sdk has no unit tests; menuAnchor/overridePendingTransition deprecations; drop coveralls?

…and jetifier

No deprecations found in build scripts (Task 1 baseline: zero Gradle
deprecation warnings), so Step 4 of the brief is a no-op. Verification
build shows only two pre-existing source-level warnings unrelated to
Gradle/AGP (Compose menuAnchor(), Java overridePendingTransition), both
in production src/ and out of scope for this task.
… targetSdk

KMP modules (updraft-core, updraft-ui-compose) fail configuration under AGP 9
with com.android.library + kotlin.multiplatform; they migrate to the new
com.android.kotlin.multiplatform.library target plugin in follow-up commits.
AGP 9's built-in Kotlin no longer allows org.jetbrains.kotlin.multiplatform
together with com.android.application in the same module. Per Kotlin's own
AGP 9 migration guide, the prescribed fix is to extract the Android entry
point into its own application module and convert the shared code module to
the Android-KMP library plugin (com.android.kotlin.multiplatform.library).
sample/composeApp is now that shared library (androidTarget + iOS targets,
namespace com.appswithlove.updraftsdk.shared); the new sample/androidApp
module holds the app shell (manifest, MainActivity, App, launcher resources,
signing, applicationId/versionCode/versionName, build types) and depends on
composeApp and updraft-sdk.

The com.appswithlove.updraft 2.3.0 plugin is parked (commented out) in
sample/androidApp/build.gradle.kts: it casts the AGP application extension to
the removed legacy AppExtension type
("ApplicationExtensionImpl$AgpDecorated_Decorated cannot be cast to
AppExtension") and fails to apply under AGP 9. Catalog entry and root
apply-false are left intact; see TODO(#16) at the commented plugin alias to
re-enable once the plugin ships AGP 9 support.
composeMultiplatform capped at 1.10.3 instead of the planned 1.11.1:
1.11.0/1.11.1 ship iOS components-resources klibs built with a
newer Kotlin/Native ABI (2.3.0) than our pinned Kotlin 2.2.21 can
consume, breaking iosSimulatorArm64Test. 1.10.3 is the newest CMP
release that still builds, tests, and publishes cleanly on 2.2.21.
Mark AGP 9 upgrade as implemented on feature/toolchain-agp9 with the
final version set (Gradle 9.6.1, AGP 9.3.1, CMP 1.10.3, vanniktech
0.37.0, dokka 2.2.0, loco 1.2.0, androidx.startup 1.2.0, coveralls
2.12.2), sample split, and parked updraft plugin.

README Kotlin compatibility matrix verified accurate, no change needed.
The AGP 9 incompatibility only affected plugin 2.x; 3.0.0 (released
2026-01-22) requires AGP 9+ and applies cleanly. Removes the TODO(#16)
park from sample/androidApp and restores the updraft {} upload wiring.
@michelutke
michelutke marked this pull request as ready for review July 31, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toolchain migration: AGP 9, Gradle 9, built-in Kotlin, plugin upgrades (loco 1.2.0)

1 participant