Commit 435ad476 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Add --all-platforms option to `flutter precache` (#5254)

parent eebe09d4
......@@ -25,6 +25,10 @@ class Cache {
// Initialized by FlutterCommandRunner on startup.
static String flutterRoot;
// Whether to cache artifacts for all platforms. Defaults to only caching
// artifacts for the current platform.
bool includeAllPlatforms = false;
static RandomAccessFile _lock;
static bool _lockEnabled = true;
......@@ -238,7 +242,9 @@ class FlutterEngine {
'android-x86',
];
if (Platform.isMacOS)
if (cache.includeAllPlatforms)
dirs.addAll(<String>['ios', 'ios-profile', 'ios-release', 'linux-x64']);
else if (Platform.isMacOS)
dirs.addAll(<String>['ios', 'ios-profile', 'ios-release']);
else if (Platform.isLinux)
dirs.add('linux-x64');
......
......@@ -8,6 +8,11 @@ import '../globals.dart';
import '../runner/flutter_command.dart';
class PrecacheCommand extends FlutterCommand {
PrecacheCommand() {
argParser.addFlag('all-platforms', abbr: 'a', negatable: false,
help: 'Precache artifacts for all platforms.');
}
@override
final String name = 'precache';
......@@ -19,6 +24,9 @@ class PrecacheCommand extends FlutterCommand {
@override
Future<int> runInProject() async {
if (argResults['all-platforms'])
cache.includeAllPlatforms = true;
if (cache.isUpToDate())
printStatus('Already up-to-date.');
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment