Skip to content

Upgrade Flutter, packages and Android build dependencies #1791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 14, 2025

Conversation

rajveermalviya
Copy link
Member

@rajveermalviya
Copy link
Member Author

This upgrade should also include the fix for dart-lang/sdk#61197, which was previously observed by @sm-sayedi, see discussion: https://chat.zulip.org/#narrow/channel/516-mobile-dev-help/topic/New.20Flutter.20upgrade.20degrades.20code.20autocompletion.

@rajveermalviya rajveermalviya added the maintainer review PR ready for review by Zulip maintainers label Aug 5, 2025
@chrisbobbe
Copy link
Collaborator

Thanks, LGTM! Marking for Greg's review.

@chrisbobbe chrisbobbe requested a review from gnprice August 6, 2025 00:17
@chrisbobbe chrisbobbe assigned gnprice and unassigned chrisbobbe Aug 6, 2025
@chrisbobbe chrisbobbe added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Aug 6, 2025
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this! Sorry for the delayed review.

These changes all look good — one question below, and a few nits.

pigeon: ^25.3.1
pigeon: ^26.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Couple of changes for @ProxyApi APIs, which we do not use.

Instead say:

Couple of changes for `@ProxyApi` APIs, which we do not use.

That avoids GitHub interpreting it as an @-mention, which GitHub handles in a spammy way in commit messages:
https://github.com/zulip/zulip-mobile/blob/main/docs/style.md#mentioning-people
https://github.com/flutter/flutter/blob/7920077a5d1e5ef670a987f592bfb6f36dc8a894/docs/contributing/Tree-hygiene.md#using-git

@@ -44,6 +44,9 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit
});
}

// TODO dart linter incorrectly flags the following regexp string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
// TODO dart linter incorrectly flags the following regexp string
// TODO(linter): The linter incorrectly flags the following regexp string

Comment on lines -248 to +251
PODFILE CHECKSUM: 66b7725a92b85e7acc28f0ced0cdacebf18e1997
PODFILE CHECKSUM: f23347f4ef610d6b07bcd5d9dc9e3ed75fb84721
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this line doesn't change in the commit that touches ios/Podfile:

9d1bd9e ios: Bump min iOS version to 15.0, as required by latest Firebase iOS SDK

I think that means this file is inaccurate either before or after that commit.

platform :ios, '14.0'
platform :ios, '15.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's explain a bit more in the commit message why this upgrade is OK. See the last such update, in a7ed31e.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also went and did a fresh round of those platform-version statistics. So you can link to this message:
#mobile > platform versions @ 💬

Comment on lines -46 to +47
firebase_core: ^3.3.0
firebase_messaging: ^15.0.1
firebase_core: ^4.0.0
firebase_messaging: ^16.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

deps: Upgrade firebase_core, firebase_messaging to latest

This commit is result of following commands:

That latter line is a lot like how we write summary lines for commits. But here in the commit-message body, it should instead be a normal English sentence:

This commit is the result of the following commands:

More generally: those summary lines are like the headlines of news articles, and the unusual, compressed syntax we use there is basically a form of "headlinese":
https://en.wikipedia.org/wiki/Headline#Headlinese

But then the body of a commit message should be written in prose, as normal English sentences (much like how the body of a news article is written in prose, and not in headlinese).

kotlinVersion=2.1.20
kotlinVersion=2.2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deps android: Upgrade Kotlin to 2.2.0, from 2.1.20

Changelog:
  https://kotlinlang.org/docs/whatsnew22.html

One item in the "Breaking changes and deprecations" section looks relevant:

We do have kotlinOptions blocks. But it looks like that error hasn't appeared in our build. Do you know why?

There's probably also an upstream Flutter issue about this, since kotlinOptions also appears in the upstream flutter create templates.

Copy link
Member Author

@rajveermalviya rajveermalviya Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these errors are only shown if the script is in Kotlin DSL script, not Groovy. I migrated build.gradle to Kotlin DSL for testing and got these errors:

e: file:///Users/rajveer/Projects/zulip-flutter/android/app/build.gradle.kts:86:4: 'val kotlinOptions: KotlinJvmOptions' is deprecated. Please migrate to the compilerOptions DSL. More details are here: https://kotl.in/u1r8ln.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/rajveer/Projects/zulip-flutter/android/app/build.gradle.kts' line: 28

* What went wrong:
Script compilation errors:

  Line 28:     kotlinOptions {
               ^ 'fun BaseAppModuleExtension.kotlinOptions(configure: Action<DeprecatedKotlinJvmOptions>): Unit' is deprecated. Please migrate to the compilerOptions DSL. More details are here: https://kotl.in/u1r8ln.

  Line 29:         jvmTarget = "1.8"
                   ^ 'var jvmTarget: String' is deprecated. Please migrate to the compilerOptions DSL. More details are here: https://kotl.in/u1r8ln.

  Line 86:    kotlinOptions.allWarningsAsErrors = name.contains("Release")
              ^ 'val kotlinOptions: KotlinJvmOptions' is deprecated. Please migrate to the compilerOptions DSL. More details are here: https://kotl.in/u1r8ln.

  Line 86:    kotlinOptions.allWarningsAsErrors = name.contains("Release")
                            ^ 'var allWarningsAsErrors: Boolean' is deprecated. Please migrate to the compilerOptions DSL. More details are here: https://kotl.in/u1r8ln.

4 errors

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, that makes sense, thanks.

I guess migrating our Gradle scripts to Kotlin would be a good thing to do too — it's already happened in the flutter create templates. But that can be a follow-up PR and a separate issue.

@rajveermalviya rajveermalviya force-pushed the pr-upgrade-flutter branch 2 times, most recently from a66b9fa to 0158bdd Compare August 14, 2025 19:51
@rajveermalviya
Copy link
Member Author

Thanks for the review @gnprice! Pushed an update, PTAL.

@rajveermalviya rajveermalviya requested a review from gnprice August 14, 2025 19:52
And update Flutter's supporting libraries to match.
… SDK

Firebase iOS SDK version 12.0 bumps minimum supported iOS version
to 15.0, see:
  https://firebase.google.com/support/release-notes/ios#version_1200_-_july_15_2025
  firebase/firebase-ios-sdk#14732

So update the min iOS version to 15.0, as we plan to bump our
Firebase dependency soon. Also based on the platform-version
statistics Greg posted:
  https://chat.zulip.org/#narrow/channel/48-mobile/topic/platform.20versions/near/2243725
we could bump it to 16.0, but there isn't specific need for that
right now, so might as well leave that for later.
This commit is the result of the following commands:
  flutter pub upgrade --major-versions firebase_messaging firebase_core
  tools/upgrade pod

Changelogs:
  https://pub.dev/packages/firebase_core/changelog#400
  https://pub.dev/packages/firebase_messaging/changelog#1600

Notable changes include bump to Firebase Android BoM (33.16.0 to 34.0.0)
and Firebase iOS SDK (11.15.0 to 12.0.0), changelog for those are at:
  https://firebase.google.com/support/release-notes/android
  https://firebase.google.com/support/release-notes/ios

In those bumps, one notable change for Android SDK is bumping
minimum SDK version to 23, but it doesn't affect us, as we already
require API 28.

Similarly, one notable change on iOS is minimum supported platform
version being changed to 15.0 on iOS and 10.15 on macOS.
Changelog:
  https://pub.dev/packages/pigeon/changelog#2600

Couple of changes for `@ProxyApi` APIs, which we do not use.
Changelog:
  https://docs.gradle.org/9.0.0/release-notes.html

Some highlights:
- Configuration Cache improves build performance by caching and
  reusing the result of the configuration phase.
- Embeds the latest stable release of Kotlin 2.2.x runtime and uses
  Kotlin language version 2.2.
- Update to Groovy 4
- Version numbers are expressed as MAJOR.MINOR.PATCH, whereas
  previous minor releases omitted the patch segment
  (e.g., 8.5 instead of 8.5.0).
Changelog:
  https://kotlinlang.org/docs/whatsnew22.html

Highlights:

  * Language features promotion to stable:
    - Guard conditions in when with a subject.
    - Non-local break and continue.
    - Multi-dollar interpolation: improved handling of $ in string literals.

  * Standard Library; Base64 API and HexFormat API are now Stable.

  * Otherwise mostly experimental features.

There is one breaking change which almost affects us:

  * In the Gradle DSL, `kotlinOptions` is deprecated in favor of
    `compilerOptions`.  The deprecation actually happened in 2.0.0
    as a warning, but is now an error:
      https://kotlinlang.org/docs/compatibility-guide-22.html#deprecate-kotlinoptions-dsl

    We're not seeing the error (and haven't seen the warning) because
    it appears only when the Gradle script is itself written in Kotlin,
    and ours are still in Groovy.  (That's zulip#1803.)  So it's no blocker,
    but it'd be good to switch to `compilerOptions`; filed as zulip#1804.
@gnprice
Copy link
Member

gnprice commented Aug 14, 2025

Thanks! Merging, with a couple more commit-message edits:

836f1d0 deps: Upgrade firebase_core, firebase_messaging to latest

-    This commit is result of the following commands:
+    This commit is the result of the following commands:

to fully convert out of headlinese, per #1791 (comment)

277fc97 deps android: Upgrade Kotlin to 2.2.0, from 2.1.20

       * Otherwise mostly experimental features.
 
+    There is one breaking change which almost affects us:
+
+      * In the Gradle DSL, `kotlinOptions` is deprecated in favor of
+        `compilerOptions`.  The deprecation actually happened in 2.0.0
+        as a warning, but is now an error:
+          https://kotlinlang.org/docs/compatibility-guide-22.html#deprecate-kotlinoptions-dsl
+
+        We're not seeing the error (and haven't seen the warning) because
+        it appears only when the Gradle script is itself written in Kotlin,
+        and ours are still in Groovy.  (That's #1803.)  So it's no blocker,
+        but it'd be good to switch to `compilerOptions`; filed as #1804.

@gnprice gnprice force-pushed the pr-upgrade-flutter branch from 0158bdd to c6fcbf6 Compare August 14, 2025 21:38
@gnprice gnprice merged commit c6fcbf6 into zulip:main Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants