Skip to content

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Nov 11, 2020

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 PackageConfig object

Follow 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.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Nov 11, 2020
@google-cla google-cla bot added the cla: yes label Nov 11, 2020
@jonahwilliams jonahwilliams marked this pull request as ready for review November 11, 2020 23:34
platformDillArtifact = Artifact.webPlatformSoundKernelDill;
extraFrontEndOptions = buildInfo.extraFrontEndOptions;
} else {
final PackageConfig packageConfig = await loadPackageConfigWithLogging(
Copy link
Contributor Author

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

@jonahwilliams jonahwilliams marked this pull request as draft November 12, 2020 00:00
@jonahwilliams
Copy link
Contributor Author

Need to figure out what to do for flutter test - probably skip the null safety mode altogether.

@flutter-dashboard
Copy link

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 package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@jonahwilliams jonahwilliams marked this pull request as ready for review November 12, 2020 23:07
Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

LGTM

@jonahwilliams jonahwilliams merged commit 0a73ecf into flutter:master Nov 13, 2020
@jonahwilliams jonahwilliams deleted the parse_packages_once branch November 13, 2020 17:41
Copy link
Member

@zanderso zanderso left a 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);
Copy link
Member

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.

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web: change SDK selection when NullSafetyMode.autodetect is working

3 participants