Avoid downloading artifacts twice (#8872)

* Avoid downloading artifacts twice

* Don't update cache before `flutter upgrade` is executed (`flutter upgrade` might bump the engine version)
* Don't update cache twice during `flutter precache`

Fixes #8249.

* add test
This commit is contained in:
Michael Goderbauer
2017-03-20 17:09:59 -07:00
committed by GitHub
parent 269538df58
commit d35a9db6fe
4 changed files with 73 additions and 1 deletions

View File

@@ -37,6 +37,8 @@ abstract class FlutterCommand extends Command<Null> {
bool get shouldRunPub => _usesPubOption && argResults['pub'];
bool get shouldUpdateCache => true;
BuildMode _defaultBuildMode;
void usesTargetOption() {
@@ -134,7 +136,8 @@ abstract class FlutterCommand extends Command<Null> {
Future<Null> verifyThenRunCommand() async {
// Populate the cache. We call this before pub get below so that the sky_engine
// package is available in the flutter cache for pub to find.
await cache.updateAll();
if (shouldUpdateCache)
await cache.updateAll();
if (shouldRunPub)
await pubGet();