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
f5672b93
Unverified
Commit
f5672b93
authored
Apr 18, 2019
by
Jonah Williams
Committed by
GitHub
Apr 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --force flag to precache (#31278)
parent
b275e111
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+6
-3
precache_test.dart
packages/flutter_tools/test/commands/precache_test.dart
+17
-0
No files found.
packages/flutter_tools/lib/src/commands/precache.dart
View file @
f5672b93
...
...
@@ -13,6 +13,8 @@ class PrecacheCommand extends FlutterCommand {
PrecacheCommand
()
{
argParser
.
addFlag
(
'all-platforms'
,
abbr:
'a'
,
negatable:
false
,
help:
'Precache artifacts for all platforms.'
);
argParser
.
addFlag
(
'force'
,
abbr:
'f'
,
negatable:
false
,
help:
'Force downloading of artifacts.'
);
argParser
.
addFlag
(
'android'
,
negatable:
true
,
defaultsTo:
true
,
help:
'Precache artifacts for Android development'
);
argParser
.
addFlag
(
'ios'
,
negatable:
true
,
defaultsTo:
true
,
...
...
@@ -55,10 +57,11 @@ class PrecacheCommand extends FlutterCommand {
requiredArtifacts
.
add
(
artifact
);
}
}
if
(
cache
.
isUpToDate
())
{
printStatus
(
'Already up-to-date.'
);
}
else
{
final
bool
forceUpdate
=
argResults
[
'force'
];
if
(
forceUpdate
||
!
cache
.
isUpToDate
())
{
await
cache
.
updateAll
(
requiredArtifacts
);
}
else
{
printStatus
(
'Already up-to-date.'
);
}
return
null
;
}
...
...
packages/flutter_tools/test/commands/precache_test.dart
View file @
f5672b93
...
...
@@ -63,6 +63,23 @@ void main() {
Cache:
()
=>
cache
,
FlutterVersion:
()
=>
flutterVersion
,
});
testUsingContext
(
'Downloads artifacts when --force is provided'
,
()
async
{
when
(
cache
.
isUpToDate
()).
thenReturn
(
true
);
// Release lock between test cases.
Cache
.
releaseLockEarly
();
final
PrecacheCommand
command
=
PrecacheCommand
();
applyMocksToCommand
(
command
);
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'precache'
,
'--force'
]);
expect
(
artifacts
,
unorderedEquals
(<
DevelopmentArtifact
>{
DevelopmentArtifact
.
universal
,
DevelopmentArtifact
.
iOS
,
DevelopmentArtifact
.
android
,
}));
},
overrides:
<
Type
,
Generator
>{
Cache:
()
=>
cache
,
FlutterVersion:
()
=>
flutterVersion
,
});
});
}
...
...
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