Skip to content

Build modernization: Gradle 9.5, AGP 9.2, Kotlin 2.3, and tooling updates#736

Open
solcott wants to merge 20 commits into
MobileNativeFoundation:mainfrom
solcott:main
Open

Build modernization: Gradle 9.5, AGP 9.2, Kotlin 2.3, and tooling updates#736
solcott wants to merge 20 commits into
MobileNativeFoundation:mainfrom
solcott:main

Conversation

@solcott

@solcott solcott commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR modernizes the build infrastructure across the board — toolchain upgrades,
configuration cache adoption, CI improvements, and migration to current plugin APIs.

Changes

Gradle & Toolchain

  • Gradle 8.6 → 9.5.1
  • Added gradle/gradle-daemon-jvm.properties pinning the daemon to Azul JDK 17
  • Enabled Gradle configuration cache (org.gradle.configuration-cache=true)
  • Disabled configureondemand (incompatible with configuration cache)
  • Added updateDaemonJvm task configured for JDK 17 / Azul

Dependency & Plugin Updates

  • AGP 8.0 → 9.2.1 (migrates to com.android.kotlin.multiplatform.library plugin)
  • Kotlin 2.0.20 → 2.3.21
  • kotlinx.coroutines 1.8.1 → 1.11.0
  • kotlinx.serialization 1.6.3 → 1.11.0
  • atomicfu 0.24.0 → 0.33.0
  • Dokka 1.9.20 → 2.2.0 (new DokkaExtension API)
  • KMMBridge 0.3.2 → 1.2.1 (migrates to co.touchlab.kmmbridge.github plugin)
  • ktlint Gradle plugin 12.1 → 14.2, ktlint 0.39 → 1.8
  • Kover 0.9.0-RC → 0.9.8
  • Binary compatibility validator 0.15.0-Beta.2 → 0.18.1
  • vanniktech maven publish 0.34 → 0.36
  • Removed unused dependencies: molecule, androidx-paging, jacoco

Build Script Modernization

  • Removed buildscript {} block — all plugins now declared via alias(libs.plugins.*) in the root build.gradle.kts
  • All plugin versions centralized in libs.versions.toml
  • Added VersionCatalogExt.kt with typed accessors for version catalog values (JVM toolchain, compat version, SDK levels, store version), replacing the hardcoded Versions object
  • JVM target/toolchain versions now driven from the version catalog (jvmToolchain = 17, jvmCompat = 11)
  • configureAndroid() updated for the new multiplatform Android library plugin API (namespace, withHostTest/withDeviceTest, compiler options)
  • Removed per-module android { namespace = ... } and AndroidManifest.xml from cache, core, and multicast — namespace now set centrally in the convention plugin
  • Migrated sourceSets { val x by getting { } } to sourceSets { x { } } idiom across submodules

CI / GitHub Actions

  • actions/checkout v4 → v6
  • actions/setup-java v4 → v5
  • gradle/gradle-build-actiongradle/actions/setup-gradle@v6
  • codecov/codecov-action v4 → v6
  • Added explicit permissions block to CI job (least-privilege: contents: read, checks: write, pull-requests: write)
  • Added --continue flag to build step so all module failures are reported in one run
  • Added JUnit test report publishing via mikepenz/action-junit-report@v5 (runs on failure too)
  • Codecov upload now guarded by github.repository == 'MobileNativeFoundation/Store' to avoid failures on forks
  • Overhauled create_swift_package.yml / KMMBridge workflows based on current KMMBridgeSPMQuickStart template; added separate KMMBridge-Debug.yml and KMMBridge-Release.yml dispatch workflows

Lint / Style

  • Added .editorconfig disabling ktlint_standard_import-ordering for Kotlin files
  • Expanded ktlint additionalEditorconfig rules to suppress several noisy checks project-wide

Other

  • rx2: migrated deprecated TestCoroutineScopeTestScope
  • cache API: relaxed getAllPresent() from abstract to default interface method
  • gradle.properties: removed deprecated kotlin.js.compiler=ir
  • VERSION_NAME set to 5.1.0-SNAPSHOT for development

@solcott

solcott commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Looks like the following github actions are not on your orgs allow list:

softprops/action-gh-release@v2 — used in create_swift_package.yml. Used for KMMBridge publishing.
touchlab/ga-update-release-tag@v1 — used in create_swift_package.yml. Used for KMMBridge publishing.

It looks like the Create Swift Package action has never been run. If you don't think it will be run in the future I can remove the KMMBridge support as well as create_swift_package.yml where these actions are used.

@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.17%. Comparing base (213e574) to head (0ce44bb).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #736   +/-   ##
=======================================
  Coverage   80.17%   80.17%           
=======================================
  Files          42       42           
  Lines         928      928           
  Branches      177      177           
=======================================
  Hits          744      744           
  Misses        110      110           
  Partials       74       74           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

solcott added 18 commits July 13, 2026 14:04
… to 1.0.0

* Upgrade Gradle from 8.6 to 8.14.4
* Upgrade `org.gradle.toolchains.foojay-resolver-convention` from 0.8.0 to 1.0.0

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Upgrade `actions/checkout` to v6
* Upgrade `actions/setup-java` to v5
* Migrate `gradle/gradle-build-action@v3` to `gradle/actions/setup-gradle@v6`
* Upgrade `codecov/codecov-action` to v6

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
The dependency is already added by Kotlin Target Hierarchy template

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
Signed-off-by: Scott Olcott <scottolcott@gmail.com>
Defining disabled rules was deprecated in build.gradle.kts files

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Migrate deprecated `kotlinOptions` to `compilerOptions` using `JvmTarget.JVM_11` in `build.gradle.kts`
* Add `browser()` target to the `wasmJs` configuration block
* Defer Kotlin compiler options configuration by using `compileTaskProvider.configure` for multiplatform and native targets
* Add explicit `kotlinx-atomic-fu` dependencies to `nativeMain`, `jsMain`, and `wasmJsMain` source sets via the version catalog
* Fix minor spacing formatting in `configureCocoapods`

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Add `updateDaemonJvm` task configuration in `build.gradle.kts` to target Java 17 and the Azul vendor
* Add `gradle/gradle-daemon-jvm.properties` with platform-specific toolchain URLs generated by the task

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
Replace hardcoded JVM, SDK, and dependency versions with version catalog
references throughout the build scripts and convention plugins.

Introduce jvmToolchain=17 and jvmCompat=11 version catalog entries to
clearly separate toolchain from target compatibility: the Gradle daemon
and Java/Kotlin compilers run on JDK 17, while compiled bytecode targets
JVM 11 for downstream consumer compatibility.

Version catalog (libs.versions.toml):
- Bump androidCompileSdk/targetSdk 33 -> 34
- Bump androidGradlePlugin 8.0.0 -> 8.2.2
- Bump atomicFu 0.24.0 -> 0.26.1
- Bump dokkaGradlePlugin 1.9.20 -> 2.2.0
- Bump ktlintGradle 12.1.0 -> 12.3.0
- Bump jacocoGradlePlugin 0.8.12 -> 0.8.14
- Bump mavenPublishPlugin 0.34.0 -> 0.35.0
- Bump spotlessPluginGradle 6.4.1 -> 8.5.1
- Bump testCore 1.6.1 -> 1.7.0
- Bump kover 0.9.0-RC -> 0.9.8
- Bump truth 1.1.3 -> 1.4.5
- Bump binary-compatibility-validator 0.15.0-Beta.2 -> 0.18.1
- Add jvmToolchain (17) and jvmCompat (11) version entries
- Add spotless plugin alias
- Remove unused molecule and paging dependencies

Convention plugins:
- Add VersionCatalogExt.kt with typed accessors for version catalog
  entries (jvmToolchain, jvmCompat, store, SDK versions)
- Replace hardcoded Versions object and magic numbers with version
  catalog lookups in AndroidConventionPlugin and
  KotlinMultiplatformConventionPlugin
- Wire jvmToolchain for compiler toolchain resolution (JDK 17) and
  jvmCompat for sourceCompatibility/targetCompatibility (JVM 11)
- Migrate to Dokka 2.x API (DokkaExtension replaces DokkaTask)
- Add ktlint plugin and configure rules to preserve single-line
  expression-body style (= with(project) {)

Root build.gradle.kts:
- Use version catalog alias for spotless plugin
- Derive JVM target/compatibility from libs.versions.jvmCompat

tooling/plugins/build.gradle.kts:
- Add ktlint plugin with rule overrides for expression-body formatting
- Derive Java/Kotlin JVM settings from version catalog

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
…endencies

* Upgrade Gradle to 9.5.1 and Kotlin to 2.3.21
* Migrate from `com.android.library` to `com.android.kotlin.multiplatform.library` in convention plugins
* Enable Gradle configuration cache and disable configure-on-demand in `gradle.properties`
* Update coroutines testing API from `TestCoroutineScope` to `TestScope` and `runTest`
* Remove redundant `AndroidManifest.xml` files and centralize Android namespace configuration in convention plugins
* Add `-Xcontext-parameters` Kotlin compiler argument in tooling:plugin module
* Upgrade various dependencies:
    * Android Gradle Plugin to 9.2.1
    * Coroutines and Serialization to 1.11.0
    * AtomicFU to 0.32.1
    * Ktlint to 1.8.0 (plugin to 14.2.0)
* Update `configureAndroid` to use context receivers and the new `KotlinMultiplatformAndroidLibraryTarget` configuration block
* Temporarily comment out `kmmBridge` plugin and related configurations

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Add `KMMBridge-Debug.yml` and `KMMBridge-Release.yml` workflows to trigger manual SPM builds
* Update `create_swift_package.yml` to a reusable `workflow_call` that handles JDK 17 setup, GitHub releases, and `kmmBridgePublish` execution
* Upgrade KMMBridge to version 1.2.1 and migrate plugin coordinates from `co.touchlab.faktory` to `co.touchlab.kmmbridge.github`
* Enable and configure the KMMBridge plugin with SPM support in `KotlinMultiplatformConventionPlugin.kt`
* Update `VERSION_NAME` to `5.1.0-SNAPSHOT` in `gradle.properties`
* Uncomment KMMBridge dependencies in `build.gradle.kts` and tooling plugin configurations

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Move repository definitions to `dependencyResolutionManagement` and `pluginManagement` in `settings.gradle`
* Replace legacy `buildscript` classpath dependencies with Version Catalog plugin aliases in `build.gradle.kts`
* Remove redundant `allprojects` repository block
* Update `libs.versions.toml` to include comprehensive plugin definitions and remove unused library entries
* Fix typo in `updateDaemonJvm` task comment

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
Signed-off-by: Scott Olcott <scottolcott@gmail.com>
…upload

* Add `contents: read`, `checks: write`, and `pull-requests: write` permissions to the `build-and-test` job
* Add `--continue` flag to the Gradle build command to ensure all tests are executed
* Add `mikepenz/action-junit-report@v5` step to publish test results
* Restrict Codecov upload step to the `MobileNativeFoundation/Store` repository via an `if` condition

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Configure the `browser` target to use Karma with Chrome Headless
* Set a 5s timeout for Mocha in both `browser` and `nodejs` test tasks

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Add `contents: write` and `packages: write` permissions to the `call-publish` job in `KMMBridge-Debug.yml` and `KMMBridge-Release.yml`

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Add `ENABLE_PUBLISHING=true` project property to the `create_swift_package.yml` workflow
* Call `gitHubReleaseArtifacts()` within the KmmBridge configuration in `KotlinMultiplatformConventionPlugin`

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Remove `mikepenz/action-junit-report` step from `.github/workflows/ci.yml`

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
Replace the separate debug/release dispatch workflows with a single
KMMBridge-Publish workflow that publishes the release XCFramework. This
removes the artifact-name collision that occurred when running both for
the same version. For debugging Kotlin from Xcode, use KMMBridge
local/dev publishing instead.

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
solcott added 2 commits July 13, 2026 14:19
* Upgrade Gradle distribution to 9.6.1 in `gradle-wrapper.properties`
* Add `distributionSha256Sum` to verify the Gradle distribution
* Configure `retries` and `retryBackOffMs` properties for distribution downloads
* Update `gradlew` and `gradlew.bat` scripts to the latest version, removing redundant `CLASSPATH` logic and improving shell environment handling

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
* Update `mavenPublishPlugin` to `0.37.0`
* Update `spotlessPluginGradle` to `8.8.0`

Signed-off-by: Scott Olcott <scottolcott@gmail.com>
@solcott

solcott commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Hi @matt-ramotar, friendly nudge on this one. I know it landed out of the blue as one big PR, and a 30-file toolchain/CI/publishing change is a lot to take on in one review, so I'm happy to make it easier to digest.

I rebased onto current main today. It's mergeable and CI is running clean, so there's nothing broken or behind to untangle here, it just needs a look.

If the size is the sticking point, I can split it into small, independently-reviewable PRs, each green on its own, in a low-risk-first order:

  1. Gradle wrapper bump (+ foojay-resolver)
  2. CI actions refresh (checkout/setup-java/setup-gradle/codecov, least-privilege permissions block)
  3. Dependency bumps (Kotlin 2.3, coroutines, serialization, atomicfu; drop unused molecule/paging/jacoco)
  4. Lint/style (.editorconfig + ktlint rules)
  5. Build-script modernization (remove buildscript {}, move plugins to version catalog, VersionCatalogExt)
  6. AGP 9.2 / Android KMP library plugin migration
  7. KMMBridge / Swift Package publishing overhaul — fully optional; I can drop this entirely if you don't publish SPM artifacts

Would that split be easier to review, or would you rather take it as one PR? Just tell me the format you prefer and I'll deliver it that way. (Also still flagging the two Actions not on the org allow-list — softprops/action-gh-release@v2 and touchlab/ga-update-release-tag@v1 — both only used by the KMMBridge workflow in #7, so they go away if you skip that piece.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🆕 Triage

Development

Successfully merging this pull request may close these issues.

1 participant