build: update Kotlin to 2.2.20 in purchases_ui_flutter - #1875
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 |
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.