Skip to content

Conversation

@mravn-google
Copy link
Contributor

Fixes #11400

Copy link
Contributor

@jakobr-google jakobr-google left a comment

Choose a reason for hiding this comment

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

LGTM

final Iterable<File> files = inputPaths.map(fs.file);
/// input files and properties provided.
class Fingerprint {
Fingerprint.fromInputs({Set<String> filePaths, Map<String, String> properties}) : _fingerprint = <String, String>{} {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: filePaths could just be an Iterable<String>, right? Then you wouldn't need to convert the lists to sets in the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

testUsingContext('throws if any input file does not exist', () async {
await fs.file('a.dart').create();
expect(() => new Checksum.fromFiles(<String>['a.dart', 'b.dart'].toSet()), throwsA(anything));
expect(() => new Fingerprint.fromInputs(filePaths: <String>['a.dart', 'b.dart'].toSet()), throwsA(anything));
Copy link
Contributor

Choose a reason for hiding this comment

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

throwsArgumentError instead of throwsA(anything)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

});

testUsingContext('rebuilds if target changes', () async {
await runAsync(<String>['flutter', 'create', projectDir.path], allowReentrantFlutter: true);
Copy link
Contributor

Choose a reason for hiding this comment

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

This'll only work if flutter is on the path (and maybe not on Windows). The other tests use createTestCommandRunner(), maybe that instead?

@mravn-google
Copy link
Contributor Author

This appeared to have already been done by #11820, but that PR only takes change of main path into account, if the different main scripts are not part of the app for any other reason than being the main entry point. Specifically, if you have lib/blue.dart and lib/red.dart with blue and red theme colors, respectively, and which import each other, then running first flutter run lib/blue.dart and then flutter run lib/red.dart does not change from blue to red.

@mravn-google mravn-google reopened this Sep 1, 2017
@Hixie
Copy link
Contributor

Hixie commented Sep 1, 2017

@cbracken will surely want to review this since this is his favourite part of the codebase.

@mravn-google
Copy link
Contributor Author

Superseded by #11924.

@mravn-google mravn-google deleted the launch_wrong_target branch December 18, 2017 21:28
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flutter run lib/foo.dart always runs the first thing built

4 participants