Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f7dc19eb
Unverified
Commit
f7dc19eb
authored
Jan 11, 2021
by
Jonah Williams
Committed by
GitHub
Jan 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] flutter precache downloads all enabled platforms if no flags are provided (#73733)
parent
7ed30cb7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
7 deletions
+43
-7
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+14
-7
precache_test.dart
...ter_tools/test/commands.shard/hermetic/precache_test.dart
+29
-0
No files found.
packages/flutter_tools/lib/src/commands/precache.dart
View file @
f7dc19eb
...
...
@@ -28,19 +28,19 @@ class PrecacheCommand extends FlutterCommand {
help:
'Precache artifacts for all host platforms.'
);
argParser
.
addFlag
(
'force'
,
abbr:
'f'
,
negatable:
false
,
help:
'Force re-downloading of artifacts.'
);
argParser
.
addFlag
(
'android'
,
negatable:
true
,
defaultsTo:
tru
e
,
argParser
.
addFlag
(
'android'
,
negatable:
true
,
defaultsTo:
fals
e
,
help:
'Precache artifacts for Android development.'
,
hide:
verboseHelp
);
argParser
.
addFlag
(
'android_gen_snapshot'
,
negatable:
true
,
defaultsTo:
tru
e
,
argParser
.
addFlag
(
'android_gen_snapshot'
,
negatable:
true
,
defaultsTo:
fals
e
,
help:
'Precache gen_snapshot for Android development.'
,
hide:
!
verboseHelp
);
argParser
.
addFlag
(
'android_maven'
,
negatable:
true
,
defaultsTo:
tru
e
,
argParser
.
addFlag
(
'android_maven'
,
negatable:
true
,
defaultsTo:
fals
e
,
help:
'Precache Gradle dependencies for Android development.'
,
hide:
!
verboseHelp
);
argParser
.
addFlag
(
'android_internal_build'
,
negatable:
true
,
defaultsTo:
false
,
help:
'Precache dependencies for internal Android development.'
,
hide:
!
verboseHelp
);
argParser
.
addFlag
(
'ios'
,
negatable:
true
,
defaultsTo:
tru
e
,
argParser
.
addFlag
(
'ios'
,
negatable:
true
,
defaultsTo:
fals
e
,
help:
'Precache artifacts for iOS development.'
);
argParser
.
addFlag
(
'web'
,
negatable:
true
,
defaultsTo:
false
,
help:
'Precache artifacts for web development.'
);
...
...
@@ -69,7 +69,9 @@ class PrecacheCommand extends FlutterCommand {
final
String
name
=
'precache'
;
@override
final
String
description
=
"Populate the Flutter tool's cache of binary artifacts."
;
final
String
description
=
"Populate the Flutter tool's cache of binary artifacts.
\n\n
"
'If no explicit platform flags are provided, this command will download the artifacts '
'for all currently enabled platforms'
;
@override
bool
get
shouldUpdateCache
=>
false
;
...
...
@@ -143,7 +145,12 @@ class PrecacheCommand extends FlutterCommand {
if
(
boolArg
(
'use-unsigned-mac-binaries'
))
{
_cache
.
useUnsignedMacBinaries
=
true
;
}
_cache
.
platformOverrideArtifacts
=
_explicitArtifactSelections
();
final
Set
<
String
>
explicitlyEnabled
=
_explicitArtifactSelections
();
_cache
.
platformOverrideArtifacts
=
explicitlyEnabled
;
// If the user did not provide any artifact flags, then download
// all artifacts that correspond to an enabled platform.
final
bool
downloadDefaultArtifacts
=
explicitlyEnabled
.
isEmpty
;
final
Map
<
String
,
String
>
umbrellaForArtifact
=
_umbrellaForArtifactMap
();
final
Set
<
DevelopmentArtifact
>
requiredArtifacts
=
<
DevelopmentArtifact
>{};
for
(
final
DevelopmentArtifact
artifact
in
DevelopmentArtifact
.
values
)
{
...
...
@@ -152,7 +159,7 @@ class PrecacheCommand extends FlutterCommand {
}
final
String
argumentName
=
umbrellaForArtifact
[
artifact
.
name
]
??
artifact
.
name
;
if
(
includeAllPlatforms
||
boolArg
(
argumentName
))
{
if
(
includeAllPlatforms
||
boolArg
(
argumentName
)
||
downloadDefaultArtifacts
)
{
requiredArtifacts
.
add
(
artifact
);
}
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/precache_test.dart
View file @
f7dc19eb
...
...
@@ -268,6 +268,7 @@ void main() {
const
<
String
>[
'precache'
,
'--no-ios'
,
'--android'
,
'--android_gen_snapshot'
,
'--android_maven'
,
'--android_internal_build'
,
...
...
@@ -403,6 +404,34 @@ void main() {
verify
(
cache
.
clearStampFiles
()).
called
(
1
);
});
testUsingContext
(
'precache downloads all enabled platforms if no flags are provided.'
,
()
async
{
final
PrecacheCommand
command
=
PrecacheCommand
(
cache:
cache
,
logger:
BufferLogger
.
test
(),
featureFlags:
TestFeatureFlags
(
isWebEnabled:
true
,
isLinuxEnabled:
true
,
isWindowsEnabled:
true
,
isMacOSEnabled:
true
,
isIOSEnabled:
false
,
isAndroidEnabled:
false
,
),
platform:
FakePlatform
(
environment:
<
String
,
String
>{}),
);
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
]);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
web
,
DevelopmentArtifact
.
macOS
,
DevelopmentArtifact
.
windows
,
DevelopmentArtifact
.
linux
,
DevelopmentArtifact
.
universal
,
// iOS and android specifically excluded
}));
});
}
class
MockCache
extends
Mock
implements
Cache
{}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment