-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[tool] Ensure that all packages format with correct language version #10374
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
[tool] Ensure that all packages format with correct language version #10374
Conversation
|
CHANGELOG/version override: the format change to a small part of |
| } | ||
|
|
||
| /// Returns all Dart package folders (e.g., examples) under the given package. | ||
| Stream<RepositoryPackage> getSubpackages(RepositoryPackage package, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just drive-by refactoring; this helper being here predates the creation of RepositoryPackage, and that class is a better home for this method (especially since it already has a similar method to find all example apps).
It changed its return from Stream to Iterable to match the existing helper function, and because we don't actually benefit from using Stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request improves the format and fetch-deps commands to correctly handle language versions in packages and their sub-packages. The changes ensure that pub get is run when needed, fixing inconsistencies in formatting, especially in CI environments. The logic for detecting stale language version resolution has been added, which is a great improvement for local development workflows. The related refactoring to move getSubpackages into RepositoryPackage and make it synchronous simplifies the code. The included tests for the new logic are comprehensive. I have one suggestion to make the SDK version constraint handling more robust.
flutter/packages@f13bad3...3caa48b 2025-11-06 [email protected] [go_router] Migrates test for leak testing (flutter/packages#10276) 2025-11-06 [email protected] Run tests on macOS 15.5 or 15.7 (flutter/packages#10336) 2025-11-06 [email protected] [pigeon] Encode custom enum as long in Kotlin generator (flutter/packages#10085) 2025-11-06 [email protected] [tool] Ensure that all packages format with correct language version (flutter/packages#10374) 2025-11-06 [email protected] Roll Flutter from e5d5c01 to c5e809a (29 revisions) (flutter/packages#10369) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This fixes two issues with the format command's language resolution handling:
pub getin sub-packages, so for the rare case of sub-packages with different min versions than their enclosing package, format behavior was inconsistent, and incorrect in CI where the tree starts clean.pub getfor some package before the last min SDK bump for that package, causing local formatting to be incorrect. This was especially problematic when doing min SDK bumps for the entire repo afterstablereleases.It also fixes the related problem that
fetch-depswas not runningpub getin sub-packages, which would have prevented the pigeon issue in CI, but not locally. Even withformatfixed, we still want everything fetched infetch-deps.The parsing does depend on internal implementation details of Dart, but we don't expect those to change frequently, and if it does we can update the detection logic as necessary. The failure mode should either be to throw, which we'll catch during the roll, or to run
pub getmore than necessary, which would just be an optimization issue rather than a correctness issue.Includes
pigeonformat changes, since now CI is enforcing the correct format instead of the incorrect format that was checked in.Fixes flutter/flutter#178072
Helps with flutter/flutter#176853
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3