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

[flutter_tools] re-use findProjectRoot on flutter command #104850

Merged

Conversation

Jasguerrero
Copy link
Contributor

@Jasguerrero Jasguerrero commented May 27, 2022

Fixes: #104760

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 27, 2022
@Jasguerrero Jasguerrero marked this pull request as ready for review May 27, 2022 20:33
@Jasguerrero Jasguerrero changed the title re-use findProjectRoot on flutter command [flutter_tools] re-use findProjectRoot on flutter command May 27, 2022
@@ -123,3 +150,30 @@ class FakePub extends Fake implements Pub {
..writeAsStringSync('{"configVersion":2,"packages":[]}');
}
}

class FakePubTargetDirectory extends Fake implements Pub {
Copy link
Member

@christopherfujino christopherfujino May 31, 2022

Choose a reason for hiding this comment

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

What about adding an optional parameter to the FakePub constructor for dartToolDir that defaults to fileSystem.currentDirectory.childDirectory('.dart_tool'), rather than creating a whole new class?

Copy link
Member

Choose a reason for hiding this comment

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

Oh wait, actually, doesn't this already get piped through as the directory parameter to .get()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh wait, actually, doesn't this already get piped through as the directory parameter to .get()?

I do not follow. Do you mean that fileSystem.currentDirectory... is not needed? This syncs are needed for the currentDirectory to be a "valid flutter project"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh I see what you mean yes I can just use the directory instead which is already in the function. Good call


await commandRunner.run(<String>['get', targetDirectory.path]);

expect(await command.usageValues, const CustomDimensions(
Copy link
Member

Choose a reason for hiding this comment

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

Should we check that .dart_tool/package_config.json got written?

Copy link
Member

Choose a reason for hiding this comment

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

I think you can delete this expectation actually, as its redundant with the previous test

Copy link
Member

@christopherfujino christopherfujino 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 3da9eee into flutter:master Jun 3, 2022
@Jasguerrero Jasguerrero deleted the fix_flutter_pub_get_target branch June 3, 2022 22:29
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 4, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
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.

[flutter_tools] flutter pub get <target_directory> not working as intended
3 participants