[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.
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
| extraFrontEndOptions.add('--sound-null-safety'); | ||
| } | ||
| } else { | ||
| assert(false); |
There was a problem hiding this comment.
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.
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.