build: update Kotlin to 2.2.20 in purchases_ui_flutter - #1875
AlvaroBrey wants to merge 1 commit into
Conversation
purchases-android v11, and the purchases-hybrid-common release that carries it, publish kotlin-stdlib with metadata 2.2.0. A Kotlin compiler reads metadata at most one minor ahead, so the 1.9.20 pinned here cannot consume it. 2.2.21 is the latest 2.2.x and matches the other repos. Only purchases_ui_flutter needs this. The purchases_flutter Android sources are Java-only, so its compileKotlin task has no sources and never reads that metadata; its own kotlin_version is left alone. The plugin pins its own KGP rather than reading it from the app, so app developers are not forced to change their Kotlin version. They do need Gradle 7.6.3 or newer, which is KGP 2.2.21's minimum.
165d1ae to
fd83630
Compare
|
Closing: this change is a no-op. Verified against a purchases-hybrid-common built with Kotlin 2.2.21 and published locally under a unique version, so resolution was provable:
So The real requirement is on the app side: a Flutter app consuming the next PHC release needs Kotlin 2.1.0 or newer in its |
> Targets the next major branch (20.0-dev) - Bumps Kotlin from 2.0.21 to 2.2.20. - Bumps `purchases-android` to `11.0.0-SNAPSHOT` which is published from the `11.0-dev` branch. - **Required by the purchases-android v11 major** (RevenueCat/purchases-android#3964). v11 publishes `kotlin-stdlib` with metadata 2.2.0, and a Kotlin compiler reads metadata at most one minor ahead, so our 2.0.21 compiler cannot consume it. - **Raises the Kotlin floor for anything that compiles Kotlin against PHC to 2.1**, because we publish `kotlin-stdlib` at compile scope too. This is not extra breakage: `api(libs.purchases)` re-exposes purchases at compile scope, so the v11 bump forces the same floor regardless of what PHC itself compiles with. - `kotlinLanguage` deliberately stays at `1.8`. Kotlin 2.2.20 still accepts it, so this is a compiler bump and not a K1 to K2 migration. Companion PRs: RevenueCat/purchases-flutter#1876 RevenueCat/react-native-purchases#1925 ### Checklist - [x] A description about what and why you are contributing - [x] The issue number(s) or PR number(s) in the description - [ ] If applicable, unit tests <details><summary>Agent description</summary> ### Motivation purchases-android v11 moves to Kotlin 2.2.21 as part of its AGP 9 upgrade. The Kotlin Gradle Plugin publishes `kotlin-stdlib` at `compile` scope, so Gradle resolves consumers onto it, and a compiler can only read metadata from at most one minor version ahead of itself. v11's stdlib carries metadata 2.2.0, which a 2.0.21 compiler rejects with: ``` Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.2.0, expected version is 2.0.0. ``` So PHC has to move to at least 2.1 before it can take v11. 2.2.20 is chosen to match what purchases-capacitor already pins, so the hybrids converge on one version. ### Why this is separable from the purchases bump PHC compiles cleanly on Kotlin 2.2.20 with `purchases` still at 10.18.1, verified locally. That makes this landable before the v11 release rather than gated behind it, which is the whole reason it is its own PR. ### Downstream impact Consumers that compile Kotlin against PHC need a compiler of 2.1 or newer after this: | Consumer | Compiler | Status | |---|---|---| | purchases-flutter `purchases_ui_flutter` | KGP 1.9.20 | needs RevenueCat/purchases-flutter#1875 | | react-native apps on RN 0.78 / 0.79 | KGP 2.0.21 | needs RevenueCat/react-native-purchases#1925 | | react-native apps on RN 0.81+ | KGP 2.1.20 | fine, reads 2.2.0 | | purchases-capacitor | 2.2.20 | fine | | cordova, unity | Java only, no Kotlin compilation | fine | **Merging this is safe. Releasing it is what needs sequencing.** Once a PHC version ships with this, the automated PHC bump PRs open against purchases-flutter and react-native-purchases and will fail their CI until their Kotlin prep lands. Land #1875 and #1925 first, or hold the PHC release for the coordinated major. ### Testing `cd android && ./gradlew assembleRelease` passes on 2.2.20 with `purchases` unchanged at 10.18.1. Only pre-existing deprecation warnings, plus the expected `Language version 1.8 is deprecated` note. The generated POM confirms the new contract: `kotlin-stdlib:2.2.20` at `compile` scope. ### Related - RevenueCat/purchases-android#3964 introduces the floor this responds to - RevenueCat/purchases-flutter#1875 and RevenueCat/react-native-purchases#1925 are the downstream Kotlin bumps that must land before a PHC release carrying this </details> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Major dependency and Kotlin compiler bumps affect all Android modules and raise the minimum Kotlin version for consumers once released; snapshot repo adds transient resolution risk until v11 is stable. > > **Overview** > **Aligns the Android hybrid-common build with purchases-android v11** by bumping the Kotlin toolchain and core SDK dependency, plus raising the compile SDK across modules. > > The version catalog moves **Kotlin from 2.0.21 to 2.2.21** and **`purchases-android` from 10.22.1 to `11.0.0-SNAPSHOT`** (with a note to pin stable `11.0.0` later). **`compileSdk` is raised from 34 to 36** in `api-tests`, `hybridcommon`, `hybridcommon-ui`, and `hybridcommon-store-galaxy`. > > **Gradle resolution** adds a temporary **Sonatype Maven Snapshots** repository scoped to `com.revenuecat.purchases` so the v11 snapshot resolves until it ships to Maven Central. > > This is primarily a **compiler and dependency floor** change (Kotlin metadata from v11 requires a newer compiler); `kotlinLanguage` stays at 1.8 per the PR intent. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a6c1eb3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
> Targets the next major branch (20.0-dev) - Bumps Kotlin from 2.0.21 to 2.2.20. - Bumps `purchases-android` to `11.0.0-SNAPSHOT` which is published from the `11.0-dev` branch. - **Required by the purchases-android v11 major** (RevenueCat/purchases-android#3964). v11 publishes `kotlin-stdlib` with metadata 2.2.0, and a Kotlin compiler reads metadata at most one minor ahead, so our 2.0.21 compiler cannot consume it. - **Raises the Kotlin floor for anything that compiles Kotlin against PHC to 2.1**, because we publish `kotlin-stdlib` at compile scope too. This is not extra breakage: `api(libs.purchases)` re-exposes purchases at compile scope, so the v11 bump forces the same floor regardless of what PHC itself compiles with. - `kotlinLanguage` deliberately stays at `1.8`. Kotlin 2.2.20 still accepts it, so this is a compiler bump and not a K1 to K2 migration. Companion PRs: RevenueCat/purchases-flutter#1876 RevenueCat/react-native-purchases#1925 - [x] A description about what and why you are contributing - [x] The issue number(s) or PR number(s) in the description - [ ] If applicable, unit tests <details><summary>Agent description</summary> purchases-android v11 moves to Kotlin 2.2.21 as part of its AGP 9 upgrade. The Kotlin Gradle Plugin publishes `kotlin-stdlib` at `compile` scope, so Gradle resolves consumers onto it, and a compiler can only read metadata from at most one minor version ahead of itself. v11's stdlib carries metadata 2.2.0, which a 2.0.21 compiler rejects with: ``` Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.2.0, expected version is 2.0.0. ``` So PHC has to move to at least 2.1 before it can take v11. 2.2.20 is chosen to match what purchases-capacitor already pins, so the hybrids converge on one version. PHC compiles cleanly on Kotlin 2.2.20 with `purchases` still at 10.18.1, verified locally. That makes this landable before the v11 release rather than gated behind it, which is the whole reason it is its own PR. Consumers that compile Kotlin against PHC need a compiler of 2.1 or newer after this: | Consumer | Compiler | Status | |---|---|---| | purchases-flutter `purchases_ui_flutter` | KGP 1.9.20 | needs RevenueCat/purchases-flutter#1875 | | react-native apps on RN 0.78 / 0.79 | KGP 2.0.21 | needs RevenueCat/react-native-purchases#1925 | | react-native apps on RN 0.81+ | KGP 2.1.20 | fine, reads 2.2.0 | | purchases-capacitor | 2.2.20 | fine | | cordova, unity | Java only, no Kotlin compilation | fine | **Merging this is safe. Releasing it is what needs sequencing.** Once a PHC version ships with this, the automated PHC bump PRs open against purchases-flutter and react-native-purchases and will fail their CI until their Kotlin prep lands. Land #1875 and #1925 first, or hold the PHC release for the coordinated major. `cd android && ./gradlew assembleRelease` passes on 2.2.20 with `purchases` unchanged at 10.18.1. Only pre-existing deprecation warnings, plus the expected `Language version 1.8 is deprecated` note. The generated POM confirms the new contract: `kotlin-stdlib:2.2.20` at `compile` scope. - RevenueCat/purchases-android#3964 introduces the floor this responds to - RevenueCat/purchases-flutter#1875 and RevenueCat/react-native-purchases#1925 are the downstream Kotlin bumps that must land before a PHC release carrying this </details> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Major dependency and Kotlin compiler bumps affect all Android modules and raise the minimum Kotlin version for consumers once released; snapshot repo adds transient resolution risk until v11 is stable. > > **Overview** > **Aligns the Android hybrid-common build with purchases-android v11** by bumping the Kotlin toolchain and core SDK dependency, plus raising the compile SDK across modules. > > The version catalog moves **Kotlin from 2.0.21 to 2.2.21** and **`purchases-android` from 10.22.1 to `11.0.0-SNAPSHOT`** (with a note to pin stable `11.0.0` later). **`compileSdk` is raised from 34 to 36** in `api-tests`, `hybridcommon`, `hybridcommon-ui`, and `hybridcommon-store-galaxy`. > > **Gradle resolution** adds a temporary **Sonatype Maven Snapshots** repository scoped to `com.revenuecat.purchases` so the v11 snapshot resolves until it ships to Maven Central. > > This is primarily a **compiler and dependency floor** change (Kotlin metadata from v11 requires a newer compiler); `kotlinLanguage` stays at 1.8 per the PR intent. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a6c1eb3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
ext.kotlin_versioninpurchases_ui_flutter/android/build.gradlefrom 1.9.20 to 2.2.20. One line.kotlin-stdlibwith metadata 2.2.0. A Kotlin compiler reads metadata at most one minor ahead, so 1.9.20 cannot consume it.purchases_flutteris deliberately untouched. Its Android sources are Java only, so itscompileKotlintask has no sources and never reads that metadata. Its stalekotlin_versionis harmless.buildscript, it does not read the app's. They do need Gradle 7.6.3 or newer, which is KGP 2.2.20's minimum.Checklist
Agent description
Motivation
purchases-android v11 moves to Kotlin 2.2.21, and purchases-hybrid-common follows in
RevenueCat/purchases-hybrid-common#1844. Both publish
kotlin-stdlibatcompilescope, so Gradleresolves consumers onto it, and a compiler reads metadata from at most one minor version ahead of
itself. The published metadata becomes 2.2.0, which a 1.9.20 compiler rejects.
Scope
Only
purchases_ui_flutterneeds the bump. Checked directly:purchases_flutter/androidpurchases_ui_flutter/androidjavacdoes not read.kotlin_modulemetadata, so a Java-only module is unaffected. Itskotlin-stdlib-jdk7dependency resolves up to the newer version at runtime, which is fine.Consumer impact
This plugin pins its Kotlin Gradle Plugin version in its own
buildscriptblock rather than readingrootProject.ext, so an app's Kotlin version is irrelevant here and app developers are not forced tochange it. The one real requirement is Gradle 7.6.3 or newer, KGP 2.2.20's stated minimum.
Relationship to #1765
#1765 restructures these same lines, moving the KGP classpath and
kotlinOptionsbehind anapplyLegacyKgpconditional for AGP 9 built-in Kotlin. That work is held on a Flutter upstreamissue (#1759) and is a different problem from this one: it is about apps that want to run AGP 9,
whereas this is about the Kotlin metadata floor.
ext.kotlin_versionsurvives #1765'srestructuring, so whichever lands second just needs a textual conflict resolved.
Testing
flutter build apk --debugonrevenuecat_examples/purchase_testerbuilds successfully with thebump applied, with
:purchases_ui_flutter:compileDebugKotlinrunning under 2.2.20. Note the plugin'sandroid/directory has no Gradle wrapper of its own, so it can only be built through a host app.Related
It in turn follows the purchases-android v11 major.