Precache platform filter change#53701
Merged
stuartmorgan-g merged 4 commits intoflutter:masterfrom Apr 1, 2020
Merged
Conversation
Makes the following changes to the behavior of precache: - The --all-platforms flags now fetches all artifacts, rather than just turning off platform filtering of selected artifacts. - Explicitly requested artifacts are no longer subject to platform filtering. E.g., 'precache --ios' will download iOS artifacts on Windows and Linux (but 'precache' without an 'ios' flag will still only download iOS artifacts on macOS). - Desktop platform artifacts now respect the bypassing of platform filtering. Fixes flutter#53272
jonahwilliams
approved these changes
Apr 1, 2020
Contributor
jonahwilliams
left a comment
There was a problem hiding this comment.
Overall change LGTM with nits
| testUsingContext('macOS desktop artifacts ignore filtering when requested', () { | ||
| final MockCache mockCache = MockCache(); | ||
| final MacOSEngineArtifacts artifacts = MacOSEngineArtifacts(mockCache); | ||
| when(mockCache.includeAllPlatforms).thenReturn(false); |
Contributor
There was a problem hiding this comment.
nit: here and elsewhere separate the test setup from the expectation with a newline.
| when(mockCache.platformOverrideArtifacts).thenReturn(<String>{'macos'}); | ||
| expect(artifacts.getBinaryDirs(), isNotEmpty); | ||
| }, overrides: <Type, Generator> { | ||
| Platform: () => FakePlatform()..operatingSystem = 'linux', |
Contributor
There was a problem hiding this comment.
nit: prefer constructor instead of setter
Suggested change
| Platform: () => FakePlatform()..operatingSystem = 'linux', | |
| Platform: () => FakePlatform(operatingSystem: 'linux'), |
|
|
||
| /// Returns a reverse mapping of _expandedArtifacts, from child artifact name | ||
| /// to umbrella name. | ||
| Map<String, String> get _umbrellaForArtifactMap { |
Contributor
There was a problem hiding this comment.
Since both of these do non-trivial calculations, I would make them methods like _getUmbrellaForArtifactMap()
Contributor
There was a problem hiding this comment.
You could also use a for element instead, if you'd like
final Map<String, String> reverseMap = <String, String>{
for (MapEntry<String, List<String>> entry in _expandedArtifacts.entries)
for (String child in entry.value)
childArtifactName: entry.key
};
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Makes the following changes to the behavior of precache:
turning off platform filtering of selected artifacts.
filtering. E.g., 'precache --ios' will download iOS artifacts on
Windows and Linux (but 'precache' without an 'ios' flag will still
only download iOS artifacts on macOS).
filtering.
Related Issues
Fixes #53272
Tests
I added the following tests: New tests for all of the above at the cache.dart and precache.dart levels.
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.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.