Skip to content

[flutter_tools] remove globals and document flutter root initialization - #67275

Closed
jonahwilliams wants to merge 9 commits into
flutter:masterfrom
jonahwilliams:cache_flutter_root_init
Closed

jonahwilliams wants to merge 9 commits into
flutter:masterfrom
jonahwilliams:cache_flutter_root_init

Conversation

@jonahwilliams

Copy link
Copy Markdown
Contributor

Description

Replace this paragraph with a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change. If you're changing visual properties, consider including before/after screenshots (and runnable code snippets to reproduce them).

Related Issues

Replace this paragraph with a list of issues related to this PR from our issue database. Indicate, which of these issues are resolved or fixed by this PR. There should be at least one issue listed here.

Tests

I added the following tests:

Replace this with a list of the tests that you added as part of this PR. A change in behavior with no test covering it
will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See Test Coverage.

Checklist

Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

@flutter-dashboard flutter-dashboard Bot added tool Affects the "flutter" command-line tool. See also t: labels. work in progress; do not review labels Oct 4, 2020
}

// If run from a bare script within the repo.
if (script.contains('flutter/packages/')) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I could not find a reasonable way to trigger this path so I removed it, it seems historical

Cache.flutterRoot = globals.fs.path.normalize(globals.fs.path.absolute(flutterRoot));
if (topLevelResults.wasParsed('flutter-root')) {
Cache.flutterRoot = globals.fs.path.normalize(
globals.fs.path.absolute(topLevelResults['flutter-root'] as String));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the flutter-root argument should be deprecated, because it massively complicates startup. The cache flutter root needs to be initialized before many of our interfaces are created/accessed for the first time, but arg parsing can only be done after a command has executed.

Since this is a fairly advanced use case, replacing it with the environment variable seems like a reasonable compromise.

@fluttergithubbot

Copy link
Copy Markdown
Contributor

This pull request is not suitable for automatic merging in its current state.

  • Please get at least one approved review before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.
  • The status or check suite Linux tool_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.
  • The status or check suite Mac tool_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.
  • The status or check suite Windows tool_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.
  • The status or check suite tool_tests-general-linux has failed. Please fix the issues identified (or deflake) before re-applying this label.
  • The status or check suite tool_tests-commands-linux has failed. Please fix the issues identified (or deflake) before re-applying this label.

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.

3 participants