Skip to content
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

Clean up null assumptions for project.dart dependencies #83445

Merged
merged 1 commit into from Jun 1, 2021

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented May 26, 2021

I started migrating project.dart and all its dependencies, and the diff was huge.
Pull out the cleanup parts in project, flutter_plugins, and cmake (kind of a random grouping) that can be done without actually migrating to null safety.

Part of #71511

@jmagman jmagman added the a: null-safety Support for the Dart's team new null safety feature label May 26, 2021
@jmagman jmagman self-assigned this May 26, 2021
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 26, 2021
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

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

@google-cla google-cla bot added the cla: yes label May 26, 2021
@@ -334,10 +350,14 @@ class FlutterProject {

/// Returns a json encoded string containing the [appName], [version], and [buildNumber] that is used to generate version.json
String getVersionInfo() {
final String buildName = manifest.buildName;
Copy link
Member Author

@jmagman jmagman May 26, 2021

Choose a reason for hiding this comment

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

This method is mostly used to generate dep files.
Could also be convinced to set version/build_number value to an empty string instead.

if (_buildSettingsByBuildContext[buildContext] == null) {
final Map<String, String> calculatedBuildSettings = await _xcodeProjectBuildSettings(buildContext);
if (calculatedBuildSettings != null) {
_buildSettingsByBuildContext[buildContext] = calculatedBuildSettings;
Copy link
Member Author

Choose a reason for hiding this comment

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

Avoid setting a _buildSettingsByBuildContext value to null.

@@ -975,12 +1004,13 @@ to migrate your project.
logger: globals.logger,
templateRenderer: globals.templateRenderer,
);
final String androidIdentifier = parent.manifest.androidPackage ?? 'com.example.${parent.manifest.appName}';
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems like a good fallback, already used in

'androidIdentifier': FlutterProject.current().manifest.androidPackage ?? 'com.example.${FlutterProject.current().manifest.appName}',

@@ -791,12 +819,13 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
logger: globals.logger,
templateRenderer: globals.templateRenderer,
);
final String iosBundleIdentifier = parent.manifest.iosBundleIdentifier ?? 'com.example.${parent.manifest.appName}';
Copy link
Member Author

Choose a reason for hiding this comment

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

See androidIdentifier comment, parent.manifest.appName seems like a fine fallback value.

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot fluttergithubbot merged commit b947121 into flutter:master Jun 1, 2021
@jmagman jmagman deleted the prep-null-cleanup branch June 1, 2021 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: null-safety Support for the Dart's team new null safety feature tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants