This reverts commit 76061c4fa95b94a8e6462eb360aa1e7456cc0de3.
This commit is contained in:
parent
76061c4fa9
commit
a5af29e83c
@ -134,7 +134,4 @@ class _FuchsiaAttachCommand extends AttachCommand {
|
|||||||
Cache.flutterRoot = '$originalWorkingDirectory/third_party/dart-pkg/git/flutter';
|
Cache.flutterRoot = '$originalWorkingDirectory/third_party/dart-pkg/git/flutter';
|
||||||
return super.runCommand();
|
return super.runCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> updateCache() async {}
|
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ BuildApp() {
|
|||||||
|
|
||||||
local framework_path="${FLUTTER_ROOT}/bin/cache/artifacts/engine/${artifact_variant}"
|
local framework_path="${FLUTTER_ROOT}/bin/cache/artifacts/engine/${artifact_variant}"
|
||||||
|
|
||||||
|
AssertExists "${framework_path}"
|
||||||
AssertExists "${project_path}"
|
AssertExists "${project_path}"
|
||||||
|
|
||||||
local derived_dir="${SOURCE_ROOT}/Flutter"
|
local derived_dir="${SOURCE_ROOT}/Flutter"
|
||||||
@ -117,12 +118,6 @@ BuildApp() {
|
|||||||
flutter_podspec="${LOCAL_ENGINE}/Flutter.podspec"
|
flutter_podspec="${LOCAL_ENGINE}/Flutter.podspec"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the framework path does not exist, ensure that it is downloaded.
|
|
||||||
if [[ ! -e "$1" ]]; then
|
|
||||||
FLUTTER_ALREADY_LOCKED = "true"
|
|
||||||
RunCommand "${FLUTTER_ROOT}/bin/flutter" precache --suppress-analytics
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -e "${project_path}/.ios" ]]; then
|
if [[ -e "${project_path}/.ios" ]]; then
|
||||||
RunCommand rm -rf -- "${derived_dir}/engine"
|
RunCommand rm -rf -- "${derived_dir}/engine"
|
||||||
mkdir "${derived_dir}/engine"
|
mkdir "${derived_dir}/engine"
|
||||||
|
@ -37,8 +37,7 @@ Future<List<int>> _attempt(Uri url, {bool onlyHeaders = false}) async {
|
|||||||
printTrace('Downloading: $url');
|
printTrace('Downloading: $url');
|
||||||
HttpClient httpClient;
|
HttpClient httpClient;
|
||||||
if (context[HttpClientFactory] != null) {
|
if (context[HttpClientFactory] != null) {
|
||||||
final HttpClientFactory httpClientFactory = context[HttpClientFactory];
|
httpClient = (context[HttpClientFactory] as HttpClientFactory)(); // ignore: avoid_as
|
||||||
httpClient = httpClientFactory();
|
|
||||||
} else {
|
} else {
|
||||||
httpClient = HttpClient();
|
httpClient = HttpClient();
|
||||||
}
|
}
|
||||||
@ -65,9 +64,9 @@ Future<List<int>> _attempt(Uri url, {bool onlyHeaders = false}) async {
|
|||||||
// If we're making a HEAD request, we're only checking to see if the URL is
|
// If we're making a HEAD request, we're only checking to see if the URL is
|
||||||
// valid.
|
// valid.
|
||||||
if (onlyHeaders) {
|
if (onlyHeaders) {
|
||||||
return (response.statusCode == HttpStatus.ok) ? <int>[] : null;
|
return (response.statusCode == 200) ? <int>[] : null;
|
||||||
}
|
}
|
||||||
if (response.statusCode != HttpStatus.ok) {
|
if (response.statusCode != 200) {
|
||||||
if (response.statusCode > 0 && response.statusCode < 500) {
|
if (response.statusCode > 0 && response.statusCode < 500) {
|
||||||
throwToolExit(
|
throwToolExit(
|
||||||
'Download failed.\n'
|
'Download failed.\n'
|
||||||
|
@ -13,7 +13,6 @@ import 'base/logger.dart';
|
|||||||
import 'base/net.dart';
|
import 'base/net.dart';
|
||||||
import 'base/os.dart';
|
import 'base/os.dart';
|
||||||
import 'base/platform.dart';
|
import 'base/platform.dart';
|
||||||
import 'build_info.dart';
|
|
||||||
import 'globals.dart';
|
import 'globals.dart';
|
||||||
|
|
||||||
/// A wrapper around the `bin/cache/` directory.
|
/// A wrapper around the `bin/cache/` directory.
|
||||||
@ -188,24 +187,7 @@ class Cache {
|
|||||||
return isOlderThanReference(entity: entity, referenceFile: flutterToolsStamp);
|
return isOlderThanReference(entity: entity, referenceFile: flutterToolsStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateResult isUpToDate({
|
bool isUpToDate() => _artifacts.every((CachedArtifact artifact) => artifact.isUpToDate());
|
||||||
List<BuildMode> buildModes = const <BuildMode>[],
|
|
||||||
List<TargetPlatform> targetPlatforms = const <TargetPlatform>[],
|
|
||||||
bool skipUnknown = true,
|
|
||||||
}) {
|
|
||||||
bool isUpToDate = true;
|
|
||||||
bool clobber = false;
|
|
||||||
for (CachedArtifact artifact in _artifacts) {
|
|
||||||
final UpdateResult result = artifact.isUpToDate(
|
|
||||||
buildModes: buildModes,
|
|
||||||
targetPlatforms: targetPlatforms,
|
|
||||||
skipUnknown: skipUnknown,
|
|
||||||
);
|
|
||||||
isUpToDate &= result.isUpToDate;
|
|
||||||
clobber |= result.clobber;
|
|
||||||
}
|
|
||||||
return UpdateResult(isUpToDate: isUpToDate, clobber: clobber);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> getThirdPartyFile(String urlStr, String serviceName) async {
|
Future<String> getThirdPartyFile(String urlStr, String serviceName) async {
|
||||||
final Uri url = Uri.parse(urlStr);
|
final Uri url = Uri.parse(urlStr);
|
||||||
@ -228,40 +210,13 @@ class Cache {
|
|||||||
return cachedFile.path;
|
return cachedFile.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateAll({
|
Future<void> updateAll() async {
|
||||||
List<BuildMode> buildModes = const <BuildMode>[],
|
if (!_lockEnabled)
|
||||||
List<TargetPlatform> targetPlatforms = const <TargetPlatform>[],
|
|
||||||
bool skipUnknown = true,
|
|
||||||
bool clobber = false,
|
|
||||||
}) async {
|
|
||||||
if (!_lockEnabled) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
for (CachedArtifact artifact in _artifacts) {
|
for (CachedArtifact artifact in _artifacts) {
|
||||||
bool localClobber = clobber;
|
if (!artifact.isUpToDate())
|
||||||
if (localClobber) {
|
await artifact.update();
|
||||||
await artifact.update(
|
|
||||||
buildModes: buildModes,
|
|
||||||
targetPlatforms: targetPlatforms,
|
|
||||||
skipUnknown: skipUnknown,
|
|
||||||
clobber: localClobber,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final UpdateResult result = artifact.isUpToDate(
|
|
||||||
buildModes: buildModes,
|
|
||||||
targetPlatforms: targetPlatforms,
|
|
||||||
skipUnknown: skipUnknown,
|
|
||||||
);
|
|
||||||
localClobber |= result.clobber;
|
|
||||||
if (localClobber || !result.isUpToDate) {
|
|
||||||
await artifact.update(
|
|
||||||
buildModes: buildModes,
|
|
||||||
targetPlatforms: targetPlatforms,
|
|
||||||
skipUnknown: skipUnknown,
|
|
||||||
clobber: localClobber,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} on SocketException catch (e) {
|
} on SocketException catch (e) {
|
||||||
if (_hostsBlockedInChina.contains(e.address?.host)) {
|
if (_hostsBlockedInChina.contains(e.address?.host)) {
|
||||||
@ -277,15 +232,6 @@ class Cache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateResult {
|
|
||||||
const UpdateResult({this.isUpToDate, this.clobber = false});
|
|
||||||
|
|
||||||
/// Whether the artifact exists and is the correct version.
|
|
||||||
final bool isUpToDate;
|
|
||||||
/// Whether the artifact needs to be redownloaded.
|
|
||||||
final bool clobber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An artifact managed by the cache.
|
/// An artifact managed by the cache.
|
||||||
abstract class CachedArtifact {
|
abstract class CachedArtifact {
|
||||||
CachedArtifact(this.name, this.cache);
|
CachedArtifact(this.name, this.cache);
|
||||||
@ -302,39 +248,19 @@ abstract class CachedArtifact {
|
|||||||
/// starting from scratch.
|
/// starting from scratch.
|
||||||
final List<File> _downloadedFiles = <File>[];
|
final List<File> _downloadedFiles = <File>[];
|
||||||
|
|
||||||
@mustCallSuper
|
bool isUpToDate() {
|
||||||
UpdateResult isUpToDate({
|
if (!location.existsSync())
|
||||||
List<BuildMode> buildModes = const <BuildMode>[],
|
return false;
|
||||||
List<TargetPlatform> targetPlatforms = const <TargetPlatform>[],
|
if (version != cache.getStampFor(name))
|
||||||
bool skipUnknown = true,
|
return false;
|
||||||
}) {
|
return isUpToDateInner();
|
||||||
if (!location.existsSync()) {
|
|
||||||
return const UpdateResult(isUpToDate: false, clobber: false);
|
|
||||||
}
|
|
||||||
if (version != cache.getStampFor(name)) {
|
|
||||||
return const UpdateResult(isUpToDate: false, clobber: true);
|
|
||||||
}
|
|
||||||
return const UpdateResult(isUpToDate: true, clobber: false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> update({
|
Future<void> update() async {
|
||||||
List<BuildMode> buildModes,
|
if (location.existsSync())
|
||||||
List<TargetPlatform> targetPlatforms,
|
|
||||||
bool skipUnknown = true,
|
|
||||||
bool clobber = false,
|
|
||||||
}) async {
|
|
||||||
if (location.existsSync() && clobber) {
|
|
||||||
location.deleteSync(recursive: true);
|
location.deleteSync(recursive: true);
|
||||||
}
|
location.createSync(recursive: true);
|
||||||
if (!location.existsSync()) {
|
await updateInner();
|
||||||
location.createSync(recursive: true);
|
|
||||||
}
|
|
||||||
await updateInner(
|
|
||||||
buildModes: buildModes,
|
|
||||||
targetPlatforms: targetPlatforms,
|
|
||||||
skipUnknown: skipUnknown,
|
|
||||||
clobber: clobber,
|
|
||||||
);
|
|
||||||
cache.setStampFor(name, version);
|
cache.setStampFor(name, version);
|
||||||
_removeDownloadedFiles();
|
_removeDownloadedFiles();
|
||||||
}
|
}
|
||||||
@ -342,9 +268,6 @@ abstract class CachedArtifact {
|
|||||||
/// Clear any zip/gzip files downloaded.
|
/// Clear any zip/gzip files downloaded.
|
||||||
void _removeDownloadedFiles() {
|
void _removeDownloadedFiles() {
|
||||||
for (File f in _downloadedFiles) {
|
for (File f in _downloadedFiles) {
|
||||||
if (!f.existsSync()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
f.deleteSync();
|
f.deleteSync();
|
||||||
for (Directory d = f.parent; d.absolute.path != cache.getDownloadDir().absolute.path; d = d.parent) {
|
for (Directory d = f.parent; d.absolute.path != cache.getDownloadDir().absolute.path; d = d.parent) {
|
||||||
if (d.listSync().isEmpty) {
|
if (d.listSync().isEmpty) {
|
||||||
@ -356,13 +279,11 @@ abstract class CachedArtifact {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Hook method for extra checks for being up-to-date.
|
||||||
|
bool isUpToDateInner() => true;
|
||||||
|
|
||||||
/// Template method to perform artifact update.
|
/// Template method to perform artifact update.
|
||||||
Future<void> updateInner({
|
Future<void> updateInner();
|
||||||
@required List<BuildMode> buildModes,
|
|
||||||
@required List<TargetPlatform> targetPlatforms,
|
|
||||||
@required bool skipUnknown,
|
|
||||||
@required bool clobber,
|
|
||||||
});
|
|
||||||
|
|
||||||
String get _storageBaseUrl {
|
String get _storageBaseUrl {
|
||||||
final String overrideUrl = platform.environment['FLUTTER_STORAGE_BASE_URL'];
|
final String overrideUrl = platform.environment['FLUTTER_STORAGE_BASE_URL'];
|
||||||
@ -430,16 +351,9 @@ class MaterialFonts extends CachedArtifact {
|
|||||||
MaterialFonts(Cache cache) : super('material_fonts', cache);
|
MaterialFonts(Cache cache) : super('material_fonts', cache);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> updateInner({
|
Future<void> updateInner() {
|
||||||
List<BuildMode> buildModes,
|
|
||||||
List<TargetPlatform> targetPlatforms,
|
|
||||||
bool skipUnknown,
|
|
||||||
bool clobber,
|
|
||||||
}) async {
|
|
||||||
final Uri archiveUri = _toStorageUri(version);
|
final Uri archiveUri = _toStorageUri(version);
|
||||||
if (fs.directory(location).listSync().isEmpty || clobber) {
|
return _downloadZipArchive('Downloading Material fonts...', archiveUri, location);
|
||||||
await _downloadZipArchive('Downloading Material fonts...', archiveUri, location);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,387 +361,100 @@ class MaterialFonts extends CachedArtifact {
|
|||||||
class FlutterEngine extends CachedArtifact {
|
class FlutterEngine extends CachedArtifact {
|
||||||
FlutterEngine(Cache cache) : super('engine', cache);
|
FlutterEngine(Cache cache) : super('engine', cache);
|
||||||
|
|
||||||
// Return a list of [BinaryArtifact]s to download.
|
List<String> _getPackageDirs() => const <String>['sky_engine'];
|
||||||
@visibleForTesting
|
|
||||||
List<BinaryArtifact> getBinaryDirs({
|
// Return a list of (cache directory path, download URL path) tuples.
|
||||||
@required List<BuildMode> buildModes,
|
List<List<String>> _getBinaryDirs() {
|
||||||
@required List<TargetPlatform> targetPlatforms,
|
final List<List<String>> binaryDirs = <List<String>>[];
|
||||||
@required bool skipUnknown,
|
|
||||||
}) {
|
binaryDirs.add(<String>['common', 'flutter_patched_sdk.zip']);
|
||||||
TargetPlatform hostPlatform;
|
|
||||||
if (cache.includeAllPlatforms) {
|
if (cache.includeAllPlatforms)
|
||||||
hostPlatform = null;
|
binaryDirs
|
||||||
} if (platform.isMacOS) {
|
..addAll(_osxBinaryDirs)
|
||||||
hostPlatform = TargetPlatform.darwin_x64;
|
..addAll(_linuxBinaryDirs)
|
||||||
} else if (platform.isLinux) {
|
..addAll(_windowsBinaryDirs)
|
||||||
hostPlatform = TargetPlatform.linux_x64;
|
..addAll(_androidBinaryDirs)
|
||||||
} else if (platform.isWindows) {
|
..addAll(_iosBinaryDirs)
|
||||||
hostPlatform = TargetPlatform.windows_x64;
|
..addAll(_dartSdks);
|
||||||
}
|
else if (platform.isLinux)
|
||||||
final List<BinaryArtifact> results = _reduceEngineBinaries(
|
binaryDirs
|
||||||
buildModes: buildModes,
|
..addAll(_linuxBinaryDirs)
|
||||||
targetPlatforms: targetPlatforms,
|
..addAll(_androidBinaryDirs);
|
||||||
hostPlatform: hostPlatform,
|
else if (platform.isMacOS)
|
||||||
skipUnknown: skipUnknown,
|
binaryDirs
|
||||||
).toList();
|
..addAll(_osxBinaryDirs)
|
||||||
if (cache.includeAllPlatforms) {
|
..addAll(_androidBinaryDirs)
|
||||||
return results + _dartSdks;
|
..addAll(_iosBinaryDirs);
|
||||||
}
|
else if (platform.isWindows)
|
||||||
return results;
|
binaryDirs
|
||||||
|
..addAll(_windowsBinaryDirs)
|
||||||
|
..addAll(_androidBinaryDirs);
|
||||||
|
|
||||||
|
return binaryDirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterable<BinaryArtifact> _reduceEngineBinaries({
|
List<List<String>> get _osxBinaryDirs => <List<String>>[
|
||||||
List<BuildMode> buildModes,
|
<String>['darwin-x64', 'darwin-x64/artifacts.zip'],
|
||||||
List<TargetPlatform> targetPlatforms,
|
<String>['android-arm-profile/darwin-x64', 'android-arm-profile/darwin-x64.zip'],
|
||||||
TargetPlatform hostPlatform,
|
<String>['android-arm-release/darwin-x64', 'android-arm-release/darwin-x64.zip'],
|
||||||
bool skipUnknown,
|
<String>['android-arm64-profile/darwin-x64', 'android-arm64-profile/darwin-x64.zip'],
|
||||||
}) {
|
<String>['android-arm64-release/darwin-x64', 'android-arm64-release/darwin-x64.zip'],
|
||||||
return _binaries.where((BinaryArtifact engineBinary) {
|
<String>['android-arm-dynamic-profile/darwin-x64', 'android-arm-dynamic-profile/darwin-x64.zip'],
|
||||||
if (hostPlatform != null && engineBinary.hostPlatform != null && engineBinary.hostPlatform != hostPlatform) {
|
<String>['android-arm-dynamic-release/darwin-x64', 'android-arm-dynamic-release/darwin-x64.zip'],
|
||||||
return false;
|
<String>['android-arm64-dynamic-profile/darwin-x64', 'android-arm64-dynamic-profile/darwin-x64.zip'],
|
||||||
}
|
<String>['android-arm64-dynamic-release/darwin-x64', 'android-arm64-dynamic-release/darwin-x64.zip'],
|
||||||
// match if artifact has no restrictions.
|
|
||||||
if (engineBinary.skipChecks || engineBinary.buildMode == null && engineBinary.targetPlatform == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final bool buildModeMatch = buildModes.any((BuildMode buildMode) => buildMode == engineBinary.buildMode);
|
|
||||||
final bool targetPlatformMatch = targetPlatforms.any((TargetPlatform targetPlatform) => targetPlatform == engineBinary.targetPlatform);
|
|
||||||
if (buildModeMatch && targetPlatformMatch // match if artifact exactly matches requiremnets.
|
|
||||||
|| skipUnknown && buildModeMatch && targetPlatforms.isEmpty // match if build mode matches but target platform is unknown.
|
|
||||||
|| skipUnknown && targetPlatformMatch && buildModes.isEmpty // match if target platform matches but build mode is null.
|
|
||||||
|| !skipUnknown && targetPlatforms.isEmpty && buildModes.isEmpty) { // match if neither are provided but skipUnknown flag is provided.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
List<BinaryArtifact> get _packages => const <BinaryArtifact>[
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'sky_engine',
|
|
||||||
fileName: 'sky_engine'
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/// This lives separately since we only download it when includeAllPlatforms is true.
|
List<List<String>> get _linuxBinaryDirs => <List<String>>[
|
||||||
List<BinaryArtifact> get _dartSdks => const <BinaryArtifact>[
|
<String>['linux-x64', 'linux-x64/artifacts.zip'],
|
||||||
BinaryArtifact(
|
<String>['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'],
|
||||||
name: 'darwin-x64',
|
<String>['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'],
|
||||||
fileName: 'dart-sdk-darwin-x64.zip',
|
<String>['android-arm64-profile/linux-x64', 'android-arm64-profile/linux-x64.zip'],
|
||||||
),
|
<String>['android-arm64-release/linux-x64', 'android-arm64-release/linux-x64.zip'],
|
||||||
BinaryArtifact(
|
<String>['android-arm-dynamic-profile/linux-x64', 'android-arm-dynamic-profile/linux-x64.zip'],
|
||||||
name: 'linux-x64',
|
<String>['android-arm-dynamic-release/linux-x64', 'android-arm-dynamic-release/linux-x64.zip'],
|
||||||
fileName: 'dart-sdk-linux-x64.zip',
|
<String>['android-arm64-dynamic-profile/linux-x64', 'android-arm64-dynamic-profile/linux-x64.zip'],
|
||||||
),
|
<String>['android-arm64-dynamic-release/linux-x64', 'android-arm64-dynamic-release/linux-x64.zip'],
|
||||||
BinaryArtifact(
|
|
||||||
name: 'windows-x64',
|
|
||||||
fileName: 'dart-sdk-windows-x64.zip',
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/// A set of all possible artifacts to download.
|
List<List<String>> get _windowsBinaryDirs => <List<String>>[
|
||||||
///
|
<String>['windows-x64', 'windows-x64/artifacts.zip'],
|
||||||
/// Adding a new artifact:
|
<String>['android-arm-profile/windows-x64', 'android-arm-profile/windows-x64.zip'],
|
||||||
///
|
<String>['android-arm-release/windows-x64', 'android-arm-release/windows-x64.zip'],
|
||||||
/// To ensure that we do not waste a user's time/data/storage, the flutter
|
<String>['android-arm64-profile/windows-x64', 'android-arm64-profile/windows-x64.zip'],
|
||||||
/// tool should only download binaries when they are required. These can be requested
|
<String>['android-arm64-release/windows-x64', 'android-arm64-release/windows-x64.zip'],
|
||||||
/// in [FlutterCommand.updateCache].
|
<String>['android-arm-dynamic-profile/windows-x64', 'android-arm-dynamic-profile/windows-x64.zip'],
|
||||||
///
|
<String>['android-arm-dynamic-release/windows-x64', 'android-arm-dynamic-release/windows-x64.zip'],
|
||||||
/// An artifact should have the following features to prevent unecessary download:
|
<String>['android-arm64-dynamic-profile/windows-x64', 'android-arm64-dynamic-profile/windows-x64.zip'],
|
||||||
///
|
<String>['android-arm64-dynamic-release/windows-x64', 'android-arm64-dynamic-release/windows-x64.zip'],
|
||||||
/// * `hostPlatform` should be one of `TargetPlatform.linux_x64`,
|
];
|
||||||
/// `TargetPlatform.darwin_x64`, or `TargetPlatfrom.windows_x64`. In the
|
|
||||||
/// case where there is no restriction it can be left as null.
|
List<List<String>> get _androidBinaryDirs => <List<String>>[
|
||||||
/// * `buildMode` should be one of `BuildMode.debug`, `BuildMode.profile`,
|
<String>['android-x86', 'android-x86/artifacts.zip'],
|
||||||
/// `BuildMode.release`, `BuildMode.dynamicRelease`, or
|
<String>['android-x64', 'android-x64/artifacts.zip'],
|
||||||
/// `BuildMode.dynamicProfile`. In the case where it is required regardless
|
<String>['android-arm', 'android-arm/artifacts.zip'],
|
||||||
/// of buildMode, it can be left null.
|
<String>['android-arm-profile', 'android-arm-profile/artifacts.zip'],
|
||||||
/// * `targetPlatform` should be one of the supported target platforms.
|
<String>['android-arm-release', 'android-arm-release/artifacts.zip'],
|
||||||
/// * If, despite the restrictions above, the artifact should still be
|
<String>['android-arm64', 'android-arm64/artifacts.zip'],
|
||||||
/// downloaded, `skipChecks` can be set to true.
|
<String>['android-arm64-profile', 'android-arm64-profile/artifacts.zip'],
|
||||||
List<BinaryArtifact> get _binaries => const <BinaryArtifact>[
|
<String>['android-arm64-release', 'android-arm64-release/artifacts.zip'],
|
||||||
BinaryArtifact(
|
<String>['android-arm-dynamic-profile', 'android-arm-dynamic-profile/artifacts.zip'],
|
||||||
name: 'common',
|
<String>['android-arm-dynamic-release', 'android-arm-dynamic-release/artifacts.zip'],
|
||||||
fileName: 'flutter_patched_sdk.zip',
|
<String>['android-arm64-dynamic-profile', 'android-arm64-dynamic-profile/artifacts.zip'],
|
||||||
),
|
<String>['android-arm64-dynamic-release', 'android-arm64-dynamic-release/artifacts.zip'],
|
||||||
BinaryArtifact(
|
];
|
||||||
name: 'linux-x64',
|
|
||||||
fileName: 'linux-x64/artifacts.zip',
|
List<List<String>> get _iosBinaryDirs => <List<String>>[
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
<String>['ios', 'ios/artifacts.zip'],
|
||||||
),
|
<String>['ios-profile', 'ios-profile/artifacts.zip'],
|
||||||
BinaryArtifact(
|
<String>['ios-release', 'ios-release/artifacts.zip'],
|
||||||
name: 'android-arm-profile/linux-x64',
|
];
|
||||||
fileName: 'android-arm-profile/linux-x64.zip',
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
List<List<String>> get _dartSdks => <List<String>> [
|
||||||
buildMode: BuildMode.profile,
|
<String>['darwin-x64', 'dart-sdk-darwin-x64.zip'],
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
<String>['linux-x64', 'dart-sdk-linux-x64.zip'],
|
||||||
skipChecks: true,
|
<String>['windows-x64', 'dart-sdk-windows-x64.zip'],
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release/linux-x64',
|
|
||||||
fileName: 'android-arm-release/linux-x64.zip',
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-profile/linux-x64',
|
|
||||||
fileName: 'android-arm64-profile/linux-x64.zip',
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-release/linux-x64',
|
|
||||||
fileName: 'android-arm64-release/linux-x64.zip',
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-dynamic-profile/linux-x64',
|
|
||||||
fileName: 'android-arm-dynamic-profile/linux-x64.zip',
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
buildMode: BuildMode.dynamicProfile,
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-dynamic-release/linux-x64',
|
|
||||||
fileName: 'android-arm-dynamic-release/linux-x64.zip',
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
buildMode: BuildMode.dynamicRelease,
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-dynamic-profile/linux-x64',
|
|
||||||
fileName: 'android-arm64-dynamic-profile/linux-x64.zip',
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
buildMode: BuildMode.dynamicProfile,
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-dynamic-release/linux-x64',
|
|
||||||
fileName: 'android-arm64-dynamic-release/linux-x64.zip',
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
buildMode: BuildMode.dynamicRelease,
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'windows-x64',
|
|
||||||
fileName: 'windows-x64/artifacts.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-profile/windows-x64',
|
|
||||||
fileName: 'android-arm-profile/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
skipChecks: true
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release/windows-x64',
|
|
||||||
fileName: 'android-arm-release/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-profile/windows-x64',
|
|
||||||
fileName: 'android-arm64-profile/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-release/windows-x64',
|
|
||||||
fileName: 'android-arm64-release/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-dynamic-profile/windows-x64',
|
|
||||||
fileName: 'android-arm-dynamic-profile/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
buildMode: BuildMode.dynamicProfile,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-dynamic-release/windows-x64',
|
|
||||||
fileName: 'android-arm-dynamic-release/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
buildMode: BuildMode.dynamicRelease,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-dynamic-profile/windows-x64',
|
|
||||||
fileName: 'android-arm64-dynamic-profile/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
buildMode: BuildMode.dynamicProfile,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-dynamic-release/windows-x64',
|
|
||||||
fileName: 'android-arm64-dynamic-release/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
buildMode: BuildMode.dynamicRelease,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-x86',
|
|
||||||
fileName: 'android-x86/artifacts.zip',
|
|
||||||
buildMode: BuildMode.debug,
|
|
||||||
targetPlatform: TargetPlatform.android_x86,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-x64',
|
|
||||||
fileName: 'android-x64/artifacts.zip',
|
|
||||||
buildMode: BuildMode.debug,
|
|
||||||
targetPlatform: TargetPlatform.android_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm',
|
|
||||||
fileName: 'android-arm/artifacts.zip',
|
|
||||||
buildMode: BuildMode.debug,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-profile',
|
|
||||||
fileName: 'android-arm-profile/artifacts.zip',
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release',
|
|
||||||
fileName: 'android-arm-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64',
|
|
||||||
fileName: 'android-arm64/artifacts.zip',
|
|
||||||
buildMode: BuildMode.debug,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-profile',
|
|
||||||
fileName: 'android-arm64-profile/artifacts.zip',
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-release',
|
|
||||||
fileName: 'android-arm64-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-dynamic-profile',
|
|
||||||
fileName: 'android-arm-dynamic-profile/artifacts.zip',
|
|
||||||
buildMode: BuildMode.dynamicProfile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-dynamic-release',
|
|
||||||
fileName: 'android-arm-dynamic-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.dynamicRelease,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-dynamic-profile',
|
|
||||||
fileName: 'android-arm64-dynamic-profile/artifacts.zip',
|
|
||||||
buildMode: BuildMode.dynamicProfile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-dynamic-release',
|
|
||||||
fileName: 'android-arm64-dynamic-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.dynamicRelease,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'ios', fileName: 'ios/artifacts.zip',
|
|
||||||
buildMode: BuildMode.debug,
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
targetPlatform: TargetPlatform.ios,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'ios-profile',
|
|
||||||
fileName: 'ios-profile/artifacts.zip',
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
targetPlatform: TargetPlatform.ios,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'ios-release',
|
|
||||||
fileName: 'ios-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
targetPlatform: TargetPlatform.ios,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'darwin-x64',
|
|
||||||
fileName: 'darwin-x64/artifacts.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-profile/darwin-x64',
|
|
||||||
fileName: 'android-arm-profile/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
skipChecks: true,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release/darwin-x64',
|
|
||||||
fileName: 'android-arm-release/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-profile/darwin-x64',
|
|
||||||
fileName: 'android-arm64-profile/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-release/darwin-x64',
|
|
||||||
fileName: 'android-arm64-release/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-dynamic-profile/darwin-x64',
|
|
||||||
fileName: 'android-arm-dynamic-profile/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.dynamicProfile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-dynamic-release/darwin-x64',
|
|
||||||
fileName: 'android-arm-dynamic-release/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.dynamicRelease,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-dynamic-profile/darwin-x64',
|
|
||||||
fileName: 'android-arm64-dynamic-profile/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.dynamicProfile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm64-dynamic-release/darwin-x64',
|
|
||||||
fileName: 'android-arm64-dynamic-release/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.dynamicRelease,
|
|
||||||
targetPlatform: TargetPlatform.android_arm64,
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// A list of cache directory paths to which the LICENSE file should be copied.
|
// A list of cache directory paths to which the LICENSE file should be copied.
|
||||||
@ -839,71 +466,52 @@ class FlutterEngine extends CachedArtifact {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
UpdateResult isUpToDate({
|
bool isUpToDateInner() {
|
||||||
List<BuildMode> buildModes = const <BuildMode>[],
|
|
||||||
List<TargetPlatform> targetPlatforms = const <TargetPlatform>[],
|
|
||||||
bool skipUnknown = true,
|
|
||||||
}) {
|
|
||||||
final UpdateResult parentResult = super.isUpToDate(
|
|
||||||
buildModes: buildModes,
|
|
||||||
targetPlatforms: targetPlatforms,
|
|
||||||
skipUnknown: skipUnknown
|
|
||||||
);
|
|
||||||
if (!parentResult.isUpToDate || parentResult.clobber) {
|
|
||||||
return parentResult;
|
|
||||||
}
|
|
||||||
final Directory pkgDir = cache.getCacheDir('pkg');
|
final Directory pkgDir = cache.getCacheDir('pkg');
|
||||||
for (BinaryArtifact packageArtifact in _packages) {
|
for (String pkgName in _getPackageDirs()) {
|
||||||
final Directory packageDirectory = packageArtifact.artifactLocation(pkgDir);
|
final String pkgPath = fs.path.join(pkgDir.path, pkgName);
|
||||||
if (!packageDirectory.existsSync()) {
|
if (!fs.directory(pkgPath).existsSync())
|
||||||
return const UpdateResult(isUpToDate: false);
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (BinaryArtifact toolsArtifact in getBinaryDirs(buildModes: buildModes, targetPlatforms: targetPlatforms, skipUnknown: skipUnknown)) {
|
|
||||||
final Directory dir = toolsArtifact.artifactLocation(location);
|
for (List<String> toolsDir in _getBinaryDirs()) {
|
||||||
if (!dir.existsSync()) {
|
final Directory dir = fs.directory(fs.path.join(location.path, toolsDir[0]));
|
||||||
return const UpdateResult(isUpToDate: false);
|
if (!dir.existsSync())
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
return const UpdateResult(isUpToDate: true);
|
|
||||||
|
for (String licenseDir in _getLicenseDirs()) {
|
||||||
|
final File file = fs.file(fs.path.join(location.path, licenseDir, 'LICENSE'));
|
||||||
|
if (!file.existsSync())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> updateInner({
|
Future<void> updateInner() async {
|
||||||
@required List<BuildMode> buildModes,
|
|
||||||
@required List<TargetPlatform> targetPlatforms,
|
|
||||||
@required bool skipUnknown,
|
|
||||||
@required bool clobber,
|
|
||||||
}) async {
|
|
||||||
final String url = '$_storageBaseUrl/flutter_infra/flutter/$version/';
|
final String url = '$_storageBaseUrl/flutter_infra/flutter/$version/';
|
||||||
final Directory packageDirectory = cache.getCacheDir('pkg');
|
|
||||||
for (BinaryArtifact rawArtifact in _packages) {
|
final Directory pkgDir = cache.getCacheDir('pkg');
|
||||||
final String pkgPath = fs.path.join(packageDirectory.path, rawArtifact.name);
|
for (String pkgName in _getPackageDirs()) {
|
||||||
|
final String pkgPath = fs.path.join(pkgDir.path, pkgName);
|
||||||
final Directory dir = fs.directory(pkgPath);
|
final Directory dir = fs.directory(pkgPath);
|
||||||
final bool exists = dir.existsSync();
|
if (dir.existsSync())
|
||||||
if (exists) {
|
|
||||||
if (!clobber) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
dir.deleteSync(recursive: true);
|
dir.deleteSync(recursive: true);
|
||||||
}
|
await _downloadZipArchive('Downloading package $pkgName...', Uri.parse(url + pkgName + '.zip'), pkgDir);
|
||||||
final Uri uri = Uri.parse('$url${rawArtifact.name}.zip');
|
|
||||||
await _downloadZipArchive('Downloading package ${rawArtifact.name}...', uri, packageDirectory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<BinaryArtifact> rawArtifacts = getBinaryDirs(buildModes: buildModes, targetPlatforms: targetPlatforms, skipUnknown: skipUnknown);
|
for (List<String> toolsDir in _getBinaryDirs()) {
|
||||||
for (BinaryArtifact rawArtifact in rawArtifacts) {
|
final String cacheDir = toolsDir[0];
|
||||||
final Directory artifactDirectory = rawArtifact.artifactLocation(location);
|
final String urlPath = toolsDir[1];
|
||||||
if (artifactDirectory.existsSync() && !clobber) {
|
final Directory dir = fs.directory(fs.path.join(location.path, cacheDir));
|
||||||
continue;
|
await _downloadZipArchive('Downloading $cacheDir tools...', Uri.parse(url + urlPath), dir);
|
||||||
}
|
|
||||||
final Uri uri = rawArtifact.artifactRemoteLocation(url);
|
|
||||||
await _downloadZipArchive('Downloading ${rawArtifact.name} tools...', uri, artifactDirectory);
|
|
||||||
_makeFilesExecutable(artifactDirectory);
|
|
||||||
|
|
||||||
final File frameworkZip = fs.file(fs.path.join(artifactDirectory.path, 'Flutter.framework.zip'));
|
_makeFilesExecutable(dir);
|
||||||
|
|
||||||
|
final File frameworkZip = fs.file(fs.path.join(dir.path, 'Flutter.framework.zip'));
|
||||||
if (frameworkZip.existsSync()) {
|
if (frameworkZip.existsSync()) {
|
||||||
final Directory framework = fs.directory(fs.path.join(artifactDirectory.path, 'Flutter.framework'));
|
final Directory framework = fs.directory(fs.path.join(dir.path, 'Flutter.framework'));
|
||||||
framework.createSync();
|
framework.createSync();
|
||||||
os.unzip(frameworkZip, framework);
|
os.unzip(frameworkZip, framework);
|
||||||
}
|
}
|
||||||
@ -912,43 +520,43 @@ class FlutterEngine extends CachedArtifact {
|
|||||||
final File licenseSource = fs.file(fs.path.join(Cache.flutterRoot, 'LICENSE'));
|
final File licenseSource = fs.file(fs.path.join(Cache.flutterRoot, 'LICENSE'));
|
||||||
for (String licenseDir in _getLicenseDirs()) {
|
for (String licenseDir in _getLicenseDirs()) {
|
||||||
final String licenseDestinationPath = fs.path.join(location.path, licenseDir, 'LICENSE');
|
final String licenseDestinationPath = fs.path.join(location.path, licenseDir, 'LICENSE');
|
||||||
// If the destination does not exist, we did not download the artifact to
|
|
||||||
// perform this operation.
|
|
||||||
if (!fs.directory(fs.path.join(location.path, licenseDir)).existsSync()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
await licenseSource.copy(licenseDestinationPath);
|
await licenseSource.copy(licenseDestinationPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks whether the remote artifacts for `engineVersion` are availible in storage.
|
Future<bool> areRemoteArtifactsAvailable({String engineVersion,
|
||||||
Future<bool> areRemoteArtifactsAvailable({
|
bool includeAllPlatforms = true}) async {
|
||||||
String engineVersion,
|
final bool includeAllPlatformsState = cache.includeAllPlatforms;
|
||||||
bool includeAllPlatforms = true,
|
|
||||||
}) async {
|
|
||||||
final bool includeAllPlatforms = cache.includeAllPlatforms;
|
|
||||||
cache.includeAllPlatforms = includeAllPlatforms;
|
cache.includeAllPlatforms = includeAllPlatforms;
|
||||||
engineVersion ??= version;
|
|
||||||
final String url = '$_storageBaseUrl/flutter_infra/flutter/$engineVersion/';
|
Future<bool> checkForArtifacts(String engineVersion) async {
|
||||||
final bool result = await () async {
|
engineVersion ??= version;
|
||||||
for (BinaryArtifact packageArtifact in _packages) {
|
final String url = '$_storageBaseUrl/flutter_infra/flutter/$engineVersion/';
|
||||||
final Uri uri = Uri.parse('$url${packageArtifact.name}.zip');
|
|
||||||
final bool exists = await _doesRemoteExist('Checking package ${packageArtifact.name} is available...', uri);
|
bool exists = false;
|
||||||
|
for (String pkgName in _getPackageDirs()) {
|
||||||
|
exists = await _doesRemoteExist('Checking package $pkgName is available...',
|
||||||
|
Uri.parse(url + pkgName + '.zip'));
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final List<BinaryArtifact> rawArtifacts = getBinaryDirs(buildModes: <BuildMode>[], targetPlatforms: <TargetPlatform>[], skipUnknown: false);
|
|
||||||
for (BinaryArtifact rawArtifact in rawArtifacts) {
|
for (List<String> toolsDir in _getBinaryDirs()) {
|
||||||
final Uri uri = Uri.parse('$url${rawArtifact.fileName}');
|
final String cacheDir = toolsDir[0];
|
||||||
final bool exists = await _doesRemoteExist('Checking ${rawArtifact.name} tools are available...', uri);
|
final String urlPath = toolsDir[1];
|
||||||
|
exists = await _doesRemoteExist('Checking $cacheDir tools are available...',
|
||||||
|
Uri.parse(url + urlPath));
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}();
|
}
|
||||||
cache.includeAllPlatforms = includeAllPlatforms;
|
|
||||||
|
final bool result = await checkForArtifacts(engineVersion);
|
||||||
|
cache.includeAllPlatforms = includeAllPlatformsState;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -957,9 +565,8 @@ class FlutterEngine extends CachedArtifact {
|
|||||||
for (FileSystemEntity entity in dir.listSync()) {
|
for (FileSystemEntity entity in dir.listSync()) {
|
||||||
if (entity is File) {
|
if (entity is File) {
|
||||||
final String name = fs.path.basename(entity.path);
|
final String name = fs.path.basename(entity.path);
|
||||||
if (name == 'flutter_tester') {
|
if (name == 'flutter_tester')
|
||||||
os.makeExecutable(entity);
|
os.makeExecutable(entity);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -974,44 +581,30 @@ class GradleWrapper extends CachedArtifact {
|
|||||||
String get _gradleWrapper => fs.path.join('gradle', 'wrapper', 'gradle-wrapper.jar');
|
String get _gradleWrapper => fs.path.join('gradle', 'wrapper', 'gradle-wrapper.jar');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> updateInner({List<BuildMode> buildModes, List<TargetPlatform> targetPlatforms, bool skipUnknown, bool clobber}) async {
|
Future<void> updateInner() {
|
||||||
final Uri archiveUri = _toStorageUri(version);
|
final Uri archiveUri = _toStorageUri(version);
|
||||||
if (fs.directory(location).listSync().isEmpty || clobber) {
|
return _downloadZippedTarball('Downloading Gradle Wrapper...', archiveUri, location).then<void>((_) {
|
||||||
await _downloadZippedTarball('Downloading Gradle Wrapper...', archiveUri, location).then<void>((_) {
|
// Delete property file, allowing templates to provide it.
|
||||||
// Delete property file, allowing templates to provide it.
|
fs.file(fs.path.join(location.path, 'gradle', 'wrapper', 'gradle-wrapper.properties')).deleteSync();
|
||||||
fs.file(fs.path.join(location.path, 'gradle', 'wrapper', 'gradle-wrapper.properties')).deleteSync();
|
// Remove NOTICE file. Should not be part of the template.
|
||||||
// Remove NOTICE file. Should not be part of the template.
|
fs.file(fs.path.join(location.path, 'NOTICE')).deleteSync();
|
||||||
fs.file(fs.path.join(location.path, 'NOTICE')).deleteSync();
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
UpdateResult isUpToDate({
|
bool isUpToDateInner() {
|
||||||
List<BuildMode> buildModes = const <BuildMode>[],
|
|
||||||
List<TargetPlatform> targetPlatforms = const <TargetPlatform>[],
|
|
||||||
bool skipUnknown = true,
|
|
||||||
}) {
|
|
||||||
final UpdateResult parentResult = super.isUpToDate(
|
|
||||||
buildModes: buildModes,
|
|
||||||
targetPlatforms: targetPlatforms,
|
|
||||||
skipUnknown: skipUnknown,
|
|
||||||
);
|
|
||||||
if (!parentResult.isUpToDate || parentResult.clobber) {
|
|
||||||
return parentResult;
|
|
||||||
}
|
|
||||||
final Directory wrapperDir = cache.getCacheDir(fs.path.join('artifacts', 'gradle_wrapper'));
|
final Directory wrapperDir = cache.getCacheDir(fs.path.join('artifacts', 'gradle_wrapper'));
|
||||||
if (!fs.directory(wrapperDir).existsSync())
|
if (!fs.directory(wrapperDir).existsSync())
|
||||||
return const UpdateResult(isUpToDate: false);
|
return false;
|
||||||
for (String scriptName in _gradleScripts) {
|
for (String scriptName in _gradleScripts) {
|
||||||
final File scriptFile = fs.file(fs.path.join(wrapperDir.path, scriptName));
|
final File scriptFile = fs.file(fs.path.join(wrapperDir.path, scriptName));
|
||||||
if (!scriptFile.existsSync())
|
if (!scriptFile.existsSync())
|
||||||
return const UpdateResult(isUpToDate: false);
|
return false;
|
||||||
}
|
}
|
||||||
final File gradleWrapperJar = fs.file(fs.path.join(wrapperDir.path, _gradleWrapper));
|
final File gradleWrapperJar = fs.file(fs.path.join(wrapperDir.path, _gradleWrapper));
|
||||||
if (!gradleWrapperJar.existsSync())
|
if (!gradleWrapperJar.existsSync())
|
||||||
return const UpdateResult(isUpToDate: false);
|
return false;
|
||||||
return const UpdateResult(isUpToDate: true);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,34 +659,3 @@ void _ensureExists(Directory directory) {
|
|||||||
if (!directory.existsSync())
|
if (!directory.existsSync())
|
||||||
directory.createSync(recursive: true);
|
directory.createSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
class BinaryArtifact {
|
|
||||||
const BinaryArtifact({
|
|
||||||
this.targetPlatform,
|
|
||||||
this.buildMode,
|
|
||||||
@required this.name,
|
|
||||||
@required this.fileName,
|
|
||||||
this.hostPlatform,
|
|
||||||
this.skipChecks = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
final TargetPlatform targetPlatform;
|
|
||||||
final TargetPlatform hostPlatform;
|
|
||||||
final BuildMode buildMode;
|
|
||||||
final String name;
|
|
||||||
final String fileName;
|
|
||||||
final bool skipChecks;
|
|
||||||
|
|
||||||
/// The location where this artifact will be cached.
|
|
||||||
Directory artifactLocation(Directory location) {
|
|
||||||
return fs.directory(fs.path.join(location.path, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The remote location where this artifact can be downloaded.
|
|
||||||
Uri artifactRemoteLocation(String baseUrl) {
|
|
||||||
return Uri.parse('$baseUrl$fileName');
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => '$name/$fileName';
|
|
||||||
}
|
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import '../build_info.dart';
|
|
||||||
import '../globals.dart';
|
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
import 'build_aot.dart';
|
import 'build_aot.dart';
|
||||||
import 'build_apk.dart';
|
import 'build_apk.dart';
|
||||||
@ -38,19 +36,4 @@ abstract class BuildSubCommand extends FlutterCommand {
|
|||||||
BuildSubCommand() {
|
BuildSubCommand() {
|
||||||
requiresPubspecYaml();
|
requiresPubspecYaml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> updateCache() async {
|
|
||||||
final BuildInfo buildInfo = getBuildInfo();
|
|
||||||
bool skipUnknown = false;
|
|
||||||
if (buildInfo.mode == null || buildInfo.targetPlatform == null) {
|
|
||||||
skipUnknown = true;
|
|
||||||
}
|
|
||||||
await cache.updateAll(
|
|
||||||
buildModes: buildInfo.mode != null ? <BuildMode>[buildInfo.mode] : <BuildMode>[],
|
|
||||||
targetPlatforms: buildInfo.targetPlatform != null ? <TargetPlatform>[buildInfo.targetPlatform] : <TargetPlatform>[],
|
|
||||||
clobber: false,
|
|
||||||
skipUnknown: skipUnknown,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import '../android/apk.dart';
|
import '../android/apk.dart';
|
||||||
import '../build_info.dart';
|
|
||||||
import '../globals.dart';
|
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
||||||
import 'build.dart';
|
import 'build.dart';
|
||||||
@ -51,23 +49,4 @@ class BuildApkCommand extends BuildSubCommand {
|
|||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> updateCache() async {
|
|
||||||
final BuildInfo buildInfo = getBuildInfo();
|
|
||||||
await cache.updateAll(
|
|
||||||
buildModes: <BuildMode>[
|
|
||||||
buildInfo.mode,
|
|
||||||
BuildMode.debug,
|
|
||||||
],
|
|
||||||
targetPlatforms: <TargetPlatform>[
|
|
||||||
TargetPlatform.android_arm,
|
|
||||||
TargetPlatform.android_arm64,
|
|
||||||
TargetPlatform.android_x64,
|
|
||||||
TargetPlatform.android_x86
|
|
||||||
],
|
|
||||||
clobber: false,
|
|
||||||
skipUnknown: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import '../android/app_bundle.dart';
|
import '../android/app_bundle.dart';
|
||||||
import '../build_info.dart';
|
|
||||||
import '../globals.dart';
|
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
||||||
import 'build.dart';
|
import 'build.dart';
|
||||||
@ -49,20 +47,4 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
|||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> updateCache() async {
|
|
||||||
final BuildInfo buildInfo = getBuildInfo();
|
|
||||||
await cache.updateAll(
|
|
||||||
buildModes: <BuildMode>[
|
|
||||||
buildInfo.mode,
|
|
||||||
],
|
|
||||||
targetPlatforms: <TargetPlatform>[
|
|
||||||
TargetPlatform.android_arm,
|
|
||||||
TargetPlatform.android_arm64,
|
|
||||||
],
|
|
||||||
clobber: false,
|
|
||||||
skipUnknown: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -48,16 +48,10 @@ class BuildIOSCommand extends BuildSubCommand {
|
|||||||
@override
|
@override
|
||||||
final String description = 'Build an iOS application bundle (Mac OS X host only).';
|
final String description = 'Build an iOS application bundle (Mac OS X host only).';
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> validateCommand() async {
|
|
||||||
defaultBuildMode = forSimulator ? BuildMode.debug : BuildMode.release;
|
|
||||||
return super.validateCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get forSimulator => argResults['simulator'];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
|
final bool forSimulator = argResults['simulator'];
|
||||||
|
defaultBuildMode = forSimulator ? BuildMode.debug : BuildMode.release;
|
||||||
|
|
||||||
if (getCurrentHostPlatform() != HostPlatform.darwin_x64)
|
if (getCurrentHostPlatform() != HostPlatform.darwin_x64)
|
||||||
throwToolExit('Building for iOS is only supported on the Mac.');
|
throwToolExit('Building for iOS is only supported on the Mac.');
|
||||||
|
@ -211,10 +211,7 @@ class CreateCommand extends FlutterCommand {
|
|||||||
throwToolExit('Neither the --flutter-root command line flag nor the FLUTTER_ROOT environment '
|
throwToolExit('Neither the --flutter-root command line flag nor the FLUTTER_ROOT environment '
|
||||||
'variable was specified. Unable to find package:flutter.', exitCode: 2);
|
'variable was specified. Unable to find package:flutter.', exitCode: 2);
|
||||||
|
|
||||||
await Cache.instance.updateAll(
|
await Cache.instance.updateAll();
|
||||||
skipUnknown: true,
|
|
||||||
clobber: false,
|
|
||||||
);
|
|
||||||
|
|
||||||
final String flutterRoot = fs.path.absolute(Cache.flutterRoot);
|
final String flutterRoot = fs.path.absolute(Cache.flutterRoot);
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import 'dart:async';
|
|||||||
|
|
||||||
import '../base/common.dart';
|
import '../base/common.dart';
|
||||||
import '../doctor.dart';
|
import '../doctor.dart';
|
||||||
import '../globals.dart';
|
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
|
|
||||||
class DoctorCommand extends FlutterCommand {
|
class DoctorCommand extends FlutterCommand {
|
||||||
@ -49,12 +48,4 @@ class DoctorCommand extends FlutterCommand {
|
|||||||
final bool success = await doctor.diagnose(androidLicenses: argResults['android-licenses'], verbose: verbose);
|
final bool success = await doctor.diagnose(androidLicenses: argResults['android-licenses'], verbose: verbose);
|
||||||
return FlutterCommandResult(success ? ExitStatus.success : ExitStatus.warning);
|
return FlutterCommandResult(success ? ExitStatus.success : ExitStatus.warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> updateCache() async {
|
|
||||||
await cache.updateAll(
|
|
||||||
clobber: false,
|
|
||||||
skipUnknown: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -223,6 +223,8 @@ class IdeConfigCommand extends FlutterCommand {
|
|||||||
throwToolExit('Currently, the only supported IDE is IntelliJ\n$usage', exitCode: 2);
|
throwToolExit('Currently, the only supported IDE is IntelliJ\n$usage', exitCode: 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await Cache.instance.updateAll();
|
||||||
|
|
||||||
if (argResults['update-templates']) {
|
if (argResults['update-templates']) {
|
||||||
_handleTemplateUpdate();
|
_handleTemplateUpdate();
|
||||||
return null;
|
return null;
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import '../cache.dart';
|
|
||||||
import '../globals.dart';
|
import '../globals.dart';
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
|
|
||||||
@ -12,8 +11,6 @@ class PrecacheCommand extends FlutterCommand {
|
|||||||
PrecacheCommand() {
|
PrecacheCommand() {
|
||||||
argParser.addFlag('all-platforms', abbr: 'a', negatable: false,
|
argParser.addFlag('all-platforms', abbr: 'a', negatable: false,
|
||||||
help: 'Precache artifacts for all platforms.');
|
help: 'Precache artifacts for all platforms.');
|
||||||
argParser.addFlag('force', abbr: 'f', negatable: false,
|
|
||||||
help: 'Force download of new cached artifacts');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -27,18 +24,14 @@ class PrecacheCommand extends FlutterCommand {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
if (argResults['all-platforms']) {
|
if (argResults['all-platforms'])
|
||||||
cache.includeAllPlatforms = true;
|
cache.includeAllPlatforms = true;
|
||||||
}
|
|
||||||
final UpdateResult result = cache.isUpToDate(skipUnknown: false);
|
if (cache.isUpToDate())
|
||||||
if (result.isUpToDate && !result.clobber && !argResults['force']) {
|
|
||||||
printStatus('Already up-to-date.');
|
printStatus('Already up-to-date.');
|
||||||
} else {
|
else
|
||||||
await cache.updateAll(
|
await cache.updateAll();
|
||||||
skipUnknown: false,
|
|
||||||
clobber: argResults['force'] || result.clobber,
|
return null;
|
||||||
);
|
|
||||||
}
|
|
||||||
return const FlutterCommandResult(ExitStatus.success);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,34 +61,6 @@ abstract class RunCommandBase extends FlutterCommand {
|
|||||||
|
|
||||||
bool get traceStartup => argResults['trace-startup'];
|
bool get traceStartup => argResults['trace-startup'];
|
||||||
String get route => argResults['route'];
|
String get route => argResults['route'];
|
||||||
|
|
||||||
@override
|
|
||||||
bool get shouldUpdateCache => true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> updateCache() async {
|
|
||||||
final BuildInfo buildInfo = getBuildInfo();
|
|
||||||
final BuildMode buildMode = buildInfo.mode ?? BuildMode.debug;
|
|
||||||
final Set<TargetPlatform> targetPlatforms = Set<TargetPlatform>();
|
|
||||||
if (buildInfo.targetPlatform != null) {
|
|
||||||
targetPlatforms.add(buildInfo.targetPlatform);
|
|
||||||
}
|
|
||||||
await for (Device device in deviceManager.getAllConnectedDevices()) {
|
|
||||||
targetPlatforms.add(await device.targetPlatform);
|
|
||||||
}
|
|
||||||
if (targetPlatforms.contains(TargetPlatform.android_arm) || targetPlatforms.contains(TargetPlatform.android_arm64)) {
|
|
||||||
targetPlatforms.add(TargetPlatform.android_x64);
|
|
||||||
targetPlatforms.add(TargetPlatform.android_x86);
|
|
||||||
targetPlatforms.add(TargetPlatform.android_arm);
|
|
||||||
targetPlatforms.add(TargetPlatform.android_arm64);
|
|
||||||
}
|
|
||||||
await cache.updateAll(
|
|
||||||
buildModes: <BuildMode>[buildMode],
|
|
||||||
targetPlatforms: targetPlatforms.toList(),
|
|
||||||
clobber: false,
|
|
||||||
skipUnknown: false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class RunCommand extends RunCommandBase {
|
class RunCommand extends RunCommandBase {
|
||||||
|
@ -323,43 +323,30 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildMode getBuildMode() {
|
BuildMode getBuildMode() {
|
||||||
bool debug;
|
final List<bool> modeFlags = <bool>[argResults['debug'], argResults['profile'], argResults['release']];
|
||||||
bool profile;
|
if (modeFlags.where((bool flag) => flag).length > 1)
|
||||||
bool release;
|
|
||||||
if (argParser.options.containsKey('debug')) {
|
|
||||||
debug = argResults['debug'];
|
|
||||||
} else {
|
|
||||||
debug = _defaultBuildMode == BuildMode.debug;
|
|
||||||
}
|
|
||||||
if (argParser.options.containsKey('profile')) {
|
|
||||||
profile = argResults['profile'];
|
|
||||||
} else {
|
|
||||||
profile = _defaultBuildMode == BuildMode.profile;
|
|
||||||
}
|
|
||||||
if (argParser.options.containsKey('release')) {
|
|
||||||
release = argResults['release'];
|
|
||||||
} else {
|
|
||||||
release = _defaultBuildMode == BuildMode.release;
|
|
||||||
}
|
|
||||||
if (debug && profile || debug && release || release && profile) {
|
|
||||||
throw UsageException('Only one of --debug, --profile, or --release can be specified.', null);
|
throw UsageException('Only one of --debug, --profile, or --release can be specified.', null);
|
||||||
}
|
|
||||||
final bool dynamicFlag = argParser.options.containsKey('dynamic')
|
final bool dynamicFlag = argParser.options.containsKey('dynamic')
|
||||||
? argResults['dynamic']
|
? argResults['dynamic']
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
if (debug) {
|
if (argResults['debug']) {
|
||||||
if (dynamicFlag) {
|
if (dynamicFlag)
|
||||||
throw ToolExit('Error: --dynamic requires --release or --profile.');
|
throw ToolExit('Error: --dynamic requires --release or --profile.');
|
||||||
}
|
|
||||||
return BuildMode.debug;
|
return BuildMode.debug;
|
||||||
}
|
}
|
||||||
if (profile) {
|
if (argResults['profile'])
|
||||||
return dynamicFlag ? BuildMode.dynamicProfile : BuildMode.profile;
|
return dynamicFlag ? BuildMode.dynamicProfile : BuildMode.profile;
|
||||||
}
|
if (argResults['release'])
|
||||||
if (release) {
|
|
||||||
return dynamicFlag ? BuildMode.dynamicRelease : BuildMode.release;
|
return dynamicFlag ? BuildMode.dynamicRelease : BuildMode.release;
|
||||||
}
|
|
||||||
|
if (_defaultBuildMode == BuildMode.debug && dynamicFlag)
|
||||||
|
throw ToolExit('Error: --dynamic requires --release or --profile.');
|
||||||
|
if (_defaultBuildMode == BuildMode.release && dynamicFlag)
|
||||||
|
return BuildMode.dynamicRelease;
|
||||||
|
if (_defaultBuildMode == BuildMode.profile && dynamicFlag)
|
||||||
|
return BuildMode.dynamicProfile;
|
||||||
|
|
||||||
return _defaultBuildMode;
|
return _defaultBuildMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +384,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
'--patch-number (${argResults['patch-number']}) must be an int.', null);
|
'--patch-number (${argResults['patch-number']}) must be an int.', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> extraFrontEndOptions =
|
String extraFrontEndOptions =
|
||||||
argParser.options.containsKey(FlutterOptions.kExtraFrontEndOptions)
|
argParser.options.containsKey(FlutterOptions.kExtraFrontEndOptions)
|
||||||
? argResults[FlutterOptions.kExtraFrontEndOptions]
|
? argResults[FlutterOptions.kExtraFrontEndOptions]
|
||||||
: null;
|
: null;
|
||||||
@ -406,9 +393,9 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
for (String expFlag in argResults[FlutterOptions.kEnableExperiment]) {
|
for (String expFlag in argResults[FlutterOptions.kEnableExperiment]) {
|
||||||
final String flag = '--enable-experiment=' + expFlag;
|
final String flag = '--enable-experiment=' + expFlag;
|
||||||
if (extraFrontEndOptions != null) {
|
if (extraFrontEndOptions != null) {
|
||||||
extraFrontEndOptions.add(flag);
|
extraFrontEndOptions += ',' + flag;
|
||||||
} else {
|
} else {
|
||||||
extraFrontEndOptions = <String>[flag];
|
extraFrontEndOptions = flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,9 +421,9 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
baselineDir: argParser.options.containsKey('baseline-dir')
|
baselineDir: argParser.options.containsKey('baseline-dir')
|
||||||
? argResults['baseline-dir']
|
? argResults['baseline-dir']
|
||||||
: null,
|
: null,
|
||||||
extraFrontEndOptions: extraFrontEndOptions?.join(', '),
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
extraGenSnapshotOptions: argParser.options.containsKey(FlutterOptions.kExtraGenSnapshotOptions)
|
extraGenSnapshotOptions: argParser.options.containsKey(FlutterOptions.kExtraGenSnapshotOptions)
|
||||||
? argResults[FlutterOptions.kExtraGenSnapshotOptions]?.join(', ')
|
? argResults[FlutterOptions.kExtraGenSnapshotOptions]
|
||||||
: null,
|
: null,
|
||||||
buildSharedLibrary: argParser.options.containsKey('build-shared-library')
|
buildSharedLibrary: argParser.options.containsKey('build-shared-library')
|
||||||
? argResults['build-shared-library']
|
? argResults['build-shared-library']
|
||||||
@ -526,19 +513,6 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A hook called to populate the cache with a particular target platform
|
|
||||||
/// or build mode.
|
|
||||||
///
|
|
||||||
/// If a command requires specific artifacts, it is it's responsibility to
|
|
||||||
/// request them here.
|
|
||||||
Future<void> updateCache() async {
|
|
||||||
// Only download the minimum set of binaries.
|
|
||||||
await cache.updateAll(
|
|
||||||
clobber: false,
|
|
||||||
skipUnknown: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Perform validation then call [runCommand] to execute the command.
|
/// Perform validation then call [runCommand] to execute the command.
|
||||||
/// Return a [Future] that completes with an exit code
|
/// Return a [Future] that completes with an exit code
|
||||||
/// indicating whether execution was successful.
|
/// indicating whether execution was successful.
|
||||||
@ -549,11 +523,11 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
Future<FlutterCommandResult> verifyThenRunCommand(String commandPath) async {
|
Future<FlutterCommandResult> verifyThenRunCommand(String commandPath) async {
|
||||||
await validateCommand();
|
await validateCommand();
|
||||||
|
|
||||||
// Populate the cache. We call this before pub get below so that the sky_engine
|
// 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.
|
// package is available in the flutter cache for pub to find.
|
||||||
if (shouldUpdateCache) {
|
if (shouldUpdateCache)
|
||||||
await updateCache();
|
await cache.updateAll();
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldRunPub) {
|
if (shouldRunPub) {
|
||||||
await pubGet(context: PubContext.getVerifyContext(name));
|
await pubGet(context: PubContext.getVerifyContext(name));
|
||||||
|
@ -6,7 +6,6 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:platform/platform.dart';
|
import 'package:platform/platform.dart';
|
||||||
|
|
||||||
@ -61,8 +60,7 @@ void main() {
|
|||||||
directory.createSync(recursive: true);
|
directory.createSync(recursive: true);
|
||||||
fs.file(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper', 'gradle', 'wrapper', 'gradle-wrapper.jar')).createSync(recursive: true);
|
fs.file(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper', 'gradle', 'wrapper', 'gradle-wrapper.jar')).createSync(recursive: true);
|
||||||
when(mockCache.getCacheDir(fs.path.join('artifacts', 'gradle_wrapper'))).thenReturn(fs.directory(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper')));
|
when(mockCache.getCacheDir(fs.path.join('artifacts', 'gradle_wrapper'))).thenReturn(fs.directory(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper')));
|
||||||
when(mockCache.getArtifactDirectory('gradle_wrapper')).thenReturn(fs.directory(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper')));
|
expect(gradleWrapper.isUpToDateInner(), false);
|
||||||
expect(gradleWrapper.isUpToDate().isUpToDate, const UpdateResult(isUpToDate: false).isUpToDate);
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Cache: ()=> mockCache,
|
Cache: ()=> mockCache,
|
||||||
FileSystem: () => fs
|
FileSystem: () => fs
|
||||||
@ -77,8 +75,7 @@ void main() {
|
|||||||
fs.file(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper', 'gradlew.bat')).createSync(recursive: true);
|
fs.file(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper', 'gradlew.bat')).createSync(recursive: true);
|
||||||
|
|
||||||
when(mockCache.getCacheDir(fs.path.join('artifacts', 'gradle_wrapper'))).thenReturn(fs.directory(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper')));
|
when(mockCache.getCacheDir(fs.path.join('artifacts', 'gradle_wrapper'))).thenReturn(fs.directory(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper')));
|
||||||
when(mockCache.getArtifactDirectory('gradle_wrapper')).thenReturn(fs.directory(fs.path.join(directory.path, 'artifacts', 'gradle_wrapper')));
|
expect(gradleWrapper.isUpToDateInner(), true);
|
||||||
expect(gradleWrapper.isUpToDate().isUpToDate, const UpdateResult(isUpToDate: true).isUpToDate);
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Cache: ()=> mockCache,
|
Cache: ()=> mockCache,
|
||||||
FileSystem: () => fs
|
FileSystem: () => fs
|
||||||
@ -87,37 +84,37 @@ void main() {
|
|||||||
test('should not be up to date, if some cached artifact is not', () {
|
test('should not be up to date, if some cached artifact is not', () {
|
||||||
final CachedArtifact artifact1 = MockCachedArtifact();
|
final CachedArtifact artifact1 = MockCachedArtifact();
|
||||||
final CachedArtifact artifact2 = MockCachedArtifact();
|
final CachedArtifact artifact2 = MockCachedArtifact();
|
||||||
when(artifact1.isUpToDate(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'))).thenReturn(const UpdateResult(isUpToDate: true, clobber: false));
|
when(artifact1.isUpToDate()).thenReturn(true);
|
||||||
when(artifact2.isUpToDate(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'))).thenReturn(const UpdateResult(isUpToDate: false, clobber: false));
|
when(artifact2.isUpToDate()).thenReturn(false);
|
||||||
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]);
|
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]);
|
||||||
expect(cache.isUpToDate().isUpToDate, isFalse);
|
expect(cache.isUpToDate(), isFalse);
|
||||||
});
|
});
|
||||||
test('should be up to date, if all cached artifacts are', () {
|
test('should be up to date, if all cached artifacts are', () {
|
||||||
final CachedArtifact artifact1 = MockCachedArtifact();
|
final CachedArtifact artifact1 = MockCachedArtifact();
|
||||||
final CachedArtifact artifact2 = MockCachedArtifact();
|
final CachedArtifact artifact2 = MockCachedArtifact();
|
||||||
when(artifact1.isUpToDate(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'))).thenReturn(const UpdateResult(isUpToDate: true, clobber: false));
|
when(artifact1.isUpToDate()).thenReturn(true);
|
||||||
when(artifact2.isUpToDate(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'))).thenReturn(const UpdateResult(isUpToDate: true, clobber: false));
|
when(artifact2.isUpToDate()).thenReturn(true);
|
||||||
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]);
|
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]);
|
||||||
expect(cache.isUpToDate().isUpToDate, isTrue);
|
expect(cache.isUpToDate(), isTrue);
|
||||||
});
|
});
|
||||||
test('should update cached artifacts which are not up to date', () async {
|
test('should update cached artifacts which are not up to date', () async {
|
||||||
final CachedArtifact artifact1 = MockCachedArtifact();
|
final CachedArtifact artifact1 = MockCachedArtifact();
|
||||||
final CachedArtifact artifact2 = MockCachedArtifact();
|
final CachedArtifact artifact2 = MockCachedArtifact();
|
||||||
when(artifact1.isUpToDate(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'))).thenReturn(const UpdateResult(isUpToDate: true, clobber: false));
|
when(artifact1.isUpToDate()).thenReturn(true);
|
||||||
when(artifact2.isUpToDate(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'))).thenReturn(const UpdateResult(isUpToDate: false, clobber: false));
|
when(artifact2.isUpToDate()).thenReturn(false);
|
||||||
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]);
|
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]);
|
||||||
await cache.updateAll();
|
await cache.updateAll();
|
||||||
verifyNever(artifact1.update(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown')));
|
verifyNever(artifact1.update());
|
||||||
verify(artifact2.update(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'), clobber: anyNamed('clobber')));
|
verify(artifact2.update());
|
||||||
});
|
});
|
||||||
testUsingContext('failed storage.googleapis.com download shows China warning', () async {
|
testUsingContext('failed storage.googleapis.com download shows China warning', () async {
|
||||||
final CachedArtifact artifact1 = MockCachedArtifact();
|
final CachedArtifact artifact1 = MockCachedArtifact();
|
||||||
final CachedArtifact artifact2 = MockCachedArtifact();
|
final CachedArtifact artifact2 = MockCachedArtifact();
|
||||||
when(artifact1.isUpToDate(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'))).thenReturn(const UpdateResult(isUpToDate: false, clobber: false));
|
when(artifact1.isUpToDate()).thenReturn(false);
|
||||||
when(artifact2.isUpToDate(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'))).thenReturn(const UpdateResult(isUpToDate: false, clobber: false));
|
when(artifact2.isUpToDate()).thenReturn(false);
|
||||||
final MockInternetAddress address = MockInternetAddress();
|
final MockInternetAddress address = MockInternetAddress();
|
||||||
when(address.host).thenReturn('storage.googleapis.com');
|
when(address.host).thenReturn('storage.googleapis.com');
|
||||||
when(artifact1.update(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'), clobber: anyNamed('clobber'))).thenThrow(SocketException(
|
when(artifact1.update()).thenThrow(SocketException(
|
||||||
'Connection reset by peer',
|
'Connection reset by peer',
|
||||||
address: address,
|
address: address,
|
||||||
));
|
));
|
||||||
@ -126,203 +123,15 @@ void main() {
|
|||||||
await cache.updateAll();
|
await cache.updateAll();
|
||||||
fail('Mock thrown exception expected');
|
fail('Mock thrown exception expected');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
verify(artifact1.update(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'), clobber: anyNamed('clobber')));
|
verify(artifact1.update());
|
||||||
// Don't continue when retrieval fails.
|
// Don't continue when retrieval fails.
|
||||||
verifyNever(artifact2.update(buildModes: anyNamed('buildModes'), targetPlatforms: anyNamed('targetPlatforms'), skipUnknown: anyNamed('skipUnknown'), clobber: anyNamed('clobber')));
|
verifyNever(artifact2.update());
|
||||||
expect(
|
expect(
|
||||||
testLogger.errorText,
|
testLogger.errorText,
|
||||||
contains('https://flutter.io/community/china'),
|
contains('https://flutter.io/community/china'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final MockPlatform macos = MockPlatform();
|
|
||||||
final MockPlatform windows = MockPlatform();
|
|
||||||
final MockPlatform linux = MockPlatform();
|
|
||||||
when(macos.isMacOS).thenReturn(true);
|
|
||||||
when(macos.isLinux).thenReturn(false);
|
|
||||||
when(macos.isWindows).thenReturn(false);
|
|
||||||
when(windows.isMacOS).thenReturn(false);
|
|
||||||
when(windows.isLinux).thenReturn(false);
|
|
||||||
when(windows.isWindows).thenReturn(true);
|
|
||||||
when(linux.isMacOS).thenReturn(false);
|
|
||||||
when(linux.isLinux).thenReturn(true);
|
|
||||||
when(linux.isWindows).thenReturn(false);
|
|
||||||
|
|
||||||
testUsingContext('Engine cache filtering - macOS', () {
|
|
||||||
final FlutterEngine flutterEngine = FlutterEngine(MockCache());
|
|
||||||
expect(flutterEngine.getBinaryDirs(
|
|
||||||
buildModes: <BuildMode>[BuildMode.release],
|
|
||||||
targetPlatforms: <TargetPlatform>[TargetPlatform.android_arm],
|
|
||||||
skipUnknown: true,
|
|
||||||
), unorderedEquals(const <BinaryArtifact>[
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'common',
|
|
||||||
fileName: 'flutter_patched_sdk.zip',
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release',
|
|
||||||
fileName: 'android-arm-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-profile/darwin-x64',
|
|
||||||
fileName: 'android-arm-profile/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
skipChecks: true,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release/darwin-x64',
|
|
||||||
fileName: 'android-arm-release/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'darwin-x64',
|
|
||||||
fileName: 'darwin-x64/artifacts.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
),
|
|
||||||
]));
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
Platform: () => macos,
|
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext('Engine cache filtering - unknown mode - macOS', () {
|
|
||||||
final FlutterEngine flutterEngine = FlutterEngine(MockCache());
|
|
||||||
expect(flutterEngine.getBinaryDirs(
|
|
||||||
buildModes: <BuildMode>[],
|
|
||||||
targetPlatforms: <TargetPlatform>[TargetPlatform.ios],
|
|
||||||
skipUnknown: true,
|
|
||||||
), unorderedEquals(const <BinaryArtifact>[
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'common',
|
|
||||||
fileName: 'flutter_patched_sdk.zip',
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-profile/darwin-x64',
|
|
||||||
fileName: 'android-arm-profile/darwin-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
skipChecks: true,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'ios', fileName: 'ios/artifacts.zip',
|
|
||||||
buildMode: BuildMode.debug,
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
targetPlatform: TargetPlatform.ios,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'ios-profile',
|
|
||||||
fileName: 'ios-profile/artifacts.zip',
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
targetPlatform: TargetPlatform.ios,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'ios-release',
|
|
||||||
fileName: 'ios-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
targetPlatform: TargetPlatform.ios,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'darwin-x64',
|
|
||||||
fileName: 'darwin-x64/artifacts.zip',
|
|
||||||
hostPlatform: TargetPlatform.darwin_x64,
|
|
||||||
),
|
|
||||||
]));
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
Platform: () => macos,
|
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext('Engine cache filtering - Windows', () {
|
|
||||||
final FlutterEngine flutterEngine = FlutterEngine(MockCache());
|
|
||||||
expect(flutterEngine.getBinaryDirs(
|
|
||||||
buildModes: <BuildMode>[BuildMode.release],
|
|
||||||
targetPlatforms: <TargetPlatform>[TargetPlatform.android_arm],
|
|
||||||
skipUnknown: true,
|
|
||||||
), unorderedEquals(const <BinaryArtifact>[
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'common',
|
|
||||||
fileName: 'flutter_patched_sdk.zip',
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release',
|
|
||||||
fileName: 'android-arm-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-profile/windows-x64',
|
|
||||||
fileName: 'android-arm-profile/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
skipChecks: true,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release/windows-x64',
|
|
||||||
fileName: 'android-arm-release/windows-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'windows-x64',
|
|
||||||
fileName: 'windows-x64/artifacts.zip',
|
|
||||||
hostPlatform: TargetPlatform.windows_x64,
|
|
||||||
),
|
|
||||||
]));
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
Platform: () => windows,
|
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext('Engine cache filtering - linux', () {
|
|
||||||
final FlutterEngine flutterEngine = FlutterEngine(MockCache());
|
|
||||||
expect(flutterEngine.getBinaryDirs(
|
|
||||||
buildModes: <BuildMode>[BuildMode.release],
|
|
||||||
targetPlatforms: <TargetPlatform>[TargetPlatform.android_arm],
|
|
||||||
skipUnknown: true,
|
|
||||||
), unorderedEquals(const <BinaryArtifact>[
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'common',
|
|
||||||
fileName: 'flutter_patched_sdk.zip',
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release',
|
|
||||||
fileName: 'android-arm-release/artifacts.zip',
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-profile/linux-x64',
|
|
||||||
fileName: 'android-arm-profile/linux-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
buildMode: BuildMode.profile,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
skipChecks: true,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'android-arm-release/linux-x64',
|
|
||||||
fileName: 'android-arm-release/linux-x64.zip',
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
buildMode: BuildMode.release,
|
|
||||||
targetPlatform: TargetPlatform.android_arm,
|
|
||||||
),
|
|
||||||
BinaryArtifact(
|
|
||||||
name: 'linux-x64',
|
|
||||||
fileName: 'linux-x64/artifacts.zip',
|
|
||||||
hostPlatform: TargetPlatform.linux_x64,
|
|
||||||
),
|
|
||||||
]));
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
Platform: () => linux,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('flattenNameSubdirs', () {
|
testUsingContext('flattenNameSubdirs', () {
|
||||||
@ -353,5 +162,4 @@ class MockFile extends Mock implements File {
|
|||||||
class MockRandomAccessFile extends Mock implements RandomAccessFile {}
|
class MockRandomAccessFile extends Mock implements RandomAccessFile {}
|
||||||
class MockCachedArtifact extends Mock implements CachedArtifact {}
|
class MockCachedArtifact extends Mock implements CachedArtifact {}
|
||||||
class MockInternetAddress extends Mock implements InternetAddress {}
|
class MockInternetAddress extends Mock implements InternetAddress {}
|
||||||
class MockCache extends Mock implements Cache {}
|
class MockCache extends Mock implements Cache {}
|
||||||
class MockPlatform extends Mock implements Platform {}
|
|
@ -42,12 +42,7 @@ void main() {
|
|||||||
testUsingContext('honors shouldUpdateCache true', () async {
|
testUsingContext('honors shouldUpdateCache true', () async {
|
||||||
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(shouldUpdateCache: true);
|
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(shouldUpdateCache: true);
|
||||||
await flutterCommand.run();
|
await flutterCommand.run();
|
||||||
verify(cache.updateAll(
|
verify(cache.updateAll()).called(1);
|
||||||
buildModes: anyNamed('buildModes'),
|
|
||||||
clobber: anyNamed('clobber'),
|
|
||||||
skipUnknown: anyNamed('skipUnknown'),
|
|
||||||
targetPlatforms: anyNamed('targetPlatforms')
|
|
||||||
)).called(1);
|
|
||||||
},
|
},
|
||||||
overrides: <Type, Generator>{
|
overrides: <Type, Generator>{
|
||||||
Cache: () => cache,
|
Cache: () => cache,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user