forked from firka/flutter
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:
committed by
GitHub
parent
269538df58
commit
d35a9db6fe
@@ -19,6 +19,9 @@ class PrecacheCommand extends FlutterCommand {
|
||||
@override
|
||||
final String description = 'Populates the Flutter tool\'s cache of binary artifacts.';
|
||||
|
||||
@override
|
||||
bool get shouldUpdateCache => false;
|
||||
|
||||
@override
|
||||
Future<Null> runCommand() async {
|
||||
if (argResults['all-platforms'])
|
||||
|
||||
@@ -22,6 +22,9 @@ class UpgradeCommand extends FlutterCommand {
|
||||
@override
|
||||
final String description = 'Upgrade your copy of Flutter.';
|
||||
|
||||
@override
|
||||
bool get shouldUpdateCache => false;
|
||||
|
||||
@override
|
||||
Future<Null> runCommand() async {
|
||||
try {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user