From 6cd90028f6b437dfaa35f6f5c9d307e741686ac7 Mon Sep 17 00:00:00 2001 From: Todd Volkert Date: Mon, 8 Aug 2016 16:18:24 -0700 Subject: [PATCH] Include all tools in the cache when --all-platforms is specified (#5296) --- packages/flutter_tools/lib/src/cache.dart | 30 ++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart index 7c05b9c0a6..ef15aca049 100644 --- a/packages/flutter_tools/lib/src/cache.dart +++ b/packages/flutter_tools/lib/src/cache.dart @@ -254,22 +254,30 @@ class FlutterEngine { // Return a list of (cache directory path, download URL path) tuples. List> _getToolsDirs() { - if (Platform.isMacOS) - return >[ - ['darwin-x64', 'darwin-x64/artifacts.zip'], - ['android-arm-profile/darwin-x64', 'android-arm-profile/darwin-x64.zip'], - ['android-arm-release/darwin-x64', 'android-arm-release/darwin-x64.zip'], - ]; + if (cache.includeAllPlatforms) + return >[] + ..addAll(_osxToolsDirs) + ..addAll(_linuxToolsDirs); + else if (Platform.isMacOS) + return _osxToolsDirs; else if (Platform.isLinux) - return >[ - ['linux-x64', 'linux-x64/artifacts.zip'], - ['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'], - ['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'], - ]; + return _linuxToolsDirs; else return >[]; } + List> get _osxToolsDirs => >[ + ['darwin-x64', 'darwin-x64/artifacts.zip'], + ['android-arm-profile/darwin-x64', 'android-arm-profile/darwin-x64.zip'], + ['android-arm-release/darwin-x64', 'android-arm-release/darwin-x64.zip'], + ]; + + List> get _linuxToolsDirs => >[ + ['linux-x64', 'linux-x64/artifacts.zip'], + ['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'], + ['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'], + ]; + bool isUpToDate() { Directory pkgDir = cache.getCacheDir('pkg'); for (String pkgName in _getPackageDirs()) {