-
Notifications
You must be signed in to change notification settings - Fork 29.8k
[flutter_tools] use initially parsed package config for language version, sound mode determination #70323
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
[flutter_tools] use initially parsed package config for language version, sound mode determination #70323
Conversation
| platformDillArtifact = Artifact.webPlatformSoundKernelDill; | ||
| extraFrontEndOptions = buildInfo.extraFrontEndOptions; | ||
| } else { | ||
| final PackageConfig packageConfig = await loadPackageConfigWithLogging( |
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 logic is now the same and shared by all platforms
|
Need to figure out what to do for |
|
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
…r into parse_packages_once
…r into parse_packages_once
…r into parse_packages_once
jmagman
left a comment
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.
LGTM
zanderso
left a comment
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.
Just a nit from me.
| extraFrontEndOptions.add('--sound-null-safety'); | ||
| } | ||
| } else { | ||
| assert(false); |
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 a bit non-idiomatic. Can this throw a tool exit or StateError instead? Alternately, assert accepts a string as second argument that can give an explanation for the assert.
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.
I count about 14 usages in the flutter tool, all for this sort of enum pattern.
Description
There are various parts of the flutter tooling that need to make use of a package config now. parse it once during getBuildInfo and re-use.
Move the null safe language determination here, using the same technique applied on the web so that the tool can correctly track whether sound or unsound mode is used.
Removes null safety mode autodetect for all modes except test. It is still required here since each individual test file could be opted in or out of null safety.
Additional bonus points: tests that are setting up dummy package_config files can now just create a
PackageConfigobjectFollow up to #70320
Work towards #69601
Fixes #70121
There are still more places where a package config is parsed in a bespoke manner - such as plugins. Fixing that is a bit out of scope.