|
|
|
|
@@ -13,7 +13,6 @@ import 'base/logger.dart';
|
|
|
|
|
import 'base/net.dart';
|
|
|
|
|
import 'base/os.dart';
|
|
|
|
|
import 'base/platform.dart';
|
|
|
|
|
import 'build_info.dart';
|
|
|
|
|
import 'globals.dart';
|
|
|
|
|
|
|
|
|
|
/// A wrapper around the `bin/cache/` directory.
|
|
|
|
|
@@ -188,20 +187,7 @@ class Cache {
|
|
|
|
|
return isOlderThanReference(entity: entity, referenceFile: flutterToolsStamp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateResult isUpToDate({
|
|
|
|
|
BuildMode buildMode,
|
|
|
|
|
TargetPlatform targetPlatform,
|
|
|
|
|
bool skipUnknown = true,
|
|
|
|
|
}) {
|
|
|
|
|
bool isUpToDate = true;
|
|
|
|
|
bool clobber = false;
|
|
|
|
|
for (CachedArtifact artifact in _artifacts) {
|
|
|
|
|
final UpdateResult result = artifact.isUpToDate(buildMode: buildMode, targetPlatform: targetPlatform, skipUnknown: skipUnknown);
|
|
|
|
|
isUpToDate &= result.isUpToDate;
|
|
|
|
|
clobber |= result.clobber;
|
|
|
|
|
}
|
|
|
|
|
return UpdateResult(isUpToDate: isUpToDate, clobber: clobber);
|
|
|
|
|
}
|
|
|
|
|
bool isUpToDate() => _artifacts.every((CachedArtifact artifact) => artifact.isUpToDate());
|
|
|
|
|
|
|
|
|
|
Future<String> getThirdPartyFile(String urlStr, String serviceName) async {
|
|
|
|
|
final Uri url = Uri.parse(urlStr);
|
|
|
|
|
@@ -224,26 +210,13 @@ class Cache {
|
|
|
|
|
return cachedFile.path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> updateAll({
|
|
|
|
|
BuildMode buildMode,
|
|
|
|
|
TargetPlatform targetPlatform,
|
|
|
|
|
bool skipUnknown = true,
|
|
|
|
|
bool clobber = false,
|
|
|
|
|
}) async {
|
|
|
|
|
if (!_lockEnabled) {
|
|
|
|
|
Future<void> updateAll() async {
|
|
|
|
|
if (!_lockEnabled)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
for (CachedArtifact artifact in _artifacts) {
|
|
|
|
|
bool localClobber = clobber;
|
|
|
|
|
if (localClobber) {
|
|
|
|
|
await artifact.update(buildMode: buildMode, targetPlatform: targetPlatform, skipUnknown: skipUnknown, clobber: localClobber);
|
|
|
|
|
}
|
|
|
|
|
final UpdateResult result = artifact.isUpToDate(buildMode: buildMode, targetPlatform: targetPlatform, skipUnknown: skipUnknown);
|
|
|
|
|
localClobber |= result.clobber;
|
|
|
|
|
if (localClobber || !result.isUpToDate) {
|
|
|
|
|
await artifact.update(buildMode: buildMode, targetPlatform: targetPlatform, skipUnknown: skipUnknown, clobber: localClobber);
|
|
|
|
|
}
|
|
|
|
|
if (!artifact.isUpToDate())
|
|
|
|
|
await artifact.update();
|
|
|
|
|
}
|
|
|
|
|
} on SocketException catch (e) {
|
|
|
|
|
if (_hostsBlockedInChina.contains(e.address?.host)) {
|
|
|
|
|
@@ -259,13 +232,6 @@ class Cache {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class UpdateResult {
|
|
|
|
|
const UpdateResult({this.isUpToDate, this.clobber});
|
|
|
|
|
|
|
|
|
|
final bool isUpToDate;
|
|
|
|
|
final bool clobber;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// An artifact managed by the cache.
|
|
|
|
|
abstract class CachedArtifact {
|
|
|
|
|
CachedArtifact(this.name, this.cache);
|
|
|
|
|
@@ -282,42 +248,19 @@ abstract class CachedArtifact {
|
|
|
|
|
/// starting from scratch.
|
|
|
|
|
final List<File> _downloadedFiles = <File>[];
|
|
|
|
|
|
|
|
|
|
UpdateResult isUpToDate({
|
|
|
|
|
BuildMode buildMode,
|
|
|
|
|
TargetPlatform targetPlatform,
|
|
|
|
|
bool skipUnknown = true,
|
|
|
|
|
}) {
|
|
|
|
|
if (!location.existsSync()) {
|
|
|
|
|
return const UpdateResult(isUpToDate: false, clobber: false);
|
|
|
|
|
} if (version != cache.getStampFor(name)) {
|
|
|
|
|
return const UpdateResult(isUpToDate: false, clobber: true);
|
|
|
|
|
}
|
|
|
|
|
final bool result = isUpToDateInner(
|
|
|
|
|
buildMode: buildMode,
|
|
|
|
|
targetPlatform: targetPlatform,
|
|
|
|
|
skipUnknown: skipUnknown,
|
|
|
|
|
);
|
|
|
|
|
return UpdateResult(isUpToDate: result, clobber: false);
|
|
|
|
|
bool isUpToDate() {
|
|
|
|
|
if (!location.existsSync())
|
|
|
|
|
return false;
|
|
|
|
|
if (version != cache.getStampFor(name))
|
|
|
|
|
return false;
|
|
|
|
|
return isUpToDateInner();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> update({
|
|
|
|
|
BuildMode buildMode,
|
|
|
|
|
TargetPlatform targetPlatform,
|
|
|
|
|
bool skipUnknown = true,
|
|
|
|
|
bool clobber = false,
|
|
|
|
|
}) async {
|
|
|
|
|
if (location.existsSync() && clobber) {
|
|
|
|
|
Future<void> update() async {
|
|
|
|
|
if (location.existsSync())
|
|
|
|
|
location.deleteSync(recursive: true);
|
|
|
|
|
}
|
|
|
|
|
if (!location.existsSync()) {
|
|
|
|
|
location.createSync(recursive: true);
|
|
|
|
|
}
|
|
|
|
|
await updateInner(
|
|
|
|
|
buildMode: buildMode,
|
|
|
|
|
targetPlatform: targetPlatform,
|
|
|
|
|
skipUnknown: skipUnknown,
|
|
|
|
|
clobber: clobber,
|
|
|
|
|
);
|
|
|
|
|
location.createSync(recursive: true);
|
|
|
|
|
await updateInner();
|
|
|
|
|
cache.setStampFor(name, version);
|
|
|
|
|
_removeDownloadedFiles();
|
|
|
|
|
}
|
|
|
|
|
@@ -325,9 +268,6 @@ abstract class CachedArtifact {
|
|
|
|
|
/// Clear any zip/gzip files downloaded.
|
|
|
|
|
void _removeDownloadedFiles() {
|
|
|
|
|
for (File f in _downloadedFiles) {
|
|
|
|
|
if (!f.existsSync()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
f.deleteSync();
|
|
|
|
|
for (Directory d = f.parent; d.absolute.path != cache.getDownloadDir().absolute.path; d = d.parent) {
|
|
|
|
|
if (d.listSync().isEmpty) {
|
|
|
|
|
@@ -340,15 +280,10 @@ abstract class CachedArtifact {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Hook method for extra checks for being up-to-date.
|
|
|
|
|
bool isUpToDateInner({BuildMode buildMode, TargetPlatform targetPlatform, bool skipUnknown}) => true;
|
|
|
|
|
bool isUpToDateInner() => true;
|
|
|
|
|
|
|
|
|
|
/// Template method to perform artifact update.
|
|
|
|
|
Future<void> updateInner({
|
|
|
|
|
@required BuildMode buildMode,
|
|
|
|
|
@required TargetPlatform targetPlatform,
|
|
|
|
|
@required bool skipUnknown,
|
|
|
|
|
@required bool clobber,
|
|
|
|
|
});
|
|
|
|
|
Future<void> updateInner();
|
|
|
|
|
|
|
|
|
|
String get _storageBaseUrl {
|
|
|
|
|
final String overrideUrl = platform.environment['FLUTTER_STORAGE_BASE_URL'];
|
|
|
|
|
@@ -416,11 +351,9 @@ class MaterialFonts extends CachedArtifact {
|
|
|
|
|
MaterialFonts(Cache cache) : super('material_fonts', cache);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> updateInner({BuildMode buildMode, TargetPlatform targetPlatform, bool skipUnknown, bool clobber}) async {
|
|
|
|
|
Future<void> updateInner() {
|
|
|
|
|
final Uri archiveUri = _toStorageUri(version);
|
|
|
|
|
if (fs.directory(location).listSync().isEmpty || clobber) {
|
|
|
|
|
await _downloadZipArchive('Downloading Material fonts...', archiveUri, location);
|
|
|
|
|
}
|
|
|
|
|
return _downloadZipArchive('Downloading Material fonts...', archiveUri, location);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -428,382 +361,100 @@ class MaterialFonts extends CachedArtifact {
|
|
|
|
|
class FlutterEngine extends CachedArtifact {
|
|
|
|
|
FlutterEngine(Cache cache) : super('engine', cache);
|
|
|
|
|
|
|
|
|
|
// Return a list of [BinaryArtifact]s to download.
|
|
|
|
|
@visibleForTesting
|
|
|
|
|
List<BinaryArtifact> getBinaryDirs({
|
|
|
|
|
@required BuildMode buildMode,
|
|
|
|
|
@required TargetPlatform targetPlatform,
|
|
|
|
|
@required bool skipUnknown,
|
|
|
|
|
}) {
|
|
|
|
|
TargetPlatform hostPlatform;
|
|
|
|
|
if (cache.includeAllPlatforms) {
|
|
|
|
|
hostPlatform = null;
|
|
|
|
|
} if (platform.isMacOS) {
|
|
|
|
|
hostPlatform = TargetPlatform.darwin_x64;
|
|
|
|
|
} else if (platform.isLinux) {
|
|
|
|
|
hostPlatform = TargetPlatform.linux_x64;
|
|
|
|
|
} else if (platform.isWindows) {
|
|
|
|
|
hostPlatform = TargetPlatform.windows_x64;
|
|
|
|
|
}
|
|
|
|
|
final List<BinaryArtifact> results = _reduceEngineBinaries(
|
|
|
|
|
buildMode: buildMode,
|
|
|
|
|
targetPlatform: targetPlatform,
|
|
|
|
|
hostPlatform: hostPlatform,
|
|
|
|
|
skipUnknown: skipUnknown,
|
|
|
|
|
).toList();
|
|
|
|
|
if (cache.includeAllPlatforms) {
|
|
|
|
|
return results + _dartSdks;
|
|
|
|
|
}
|
|
|
|
|
return results;
|
|
|
|
|
List<String> _getPackageDirs() => const <String>['sky_engine'];
|
|
|
|
|
|
|
|
|
|
// Return a list of (cache directory path, download URL path) tuples.
|
|
|
|
|
List<List<String>> _getBinaryDirs() {
|
|
|
|
|
final List<List<String>> binaryDirs = <List<String>>[];
|
|
|
|
|
|
|
|
|
|
binaryDirs.add(<String>['common', 'flutter_patched_sdk.zip']);
|
|
|
|
|
|
|
|
|
|
if (cache.includeAllPlatforms)
|
|
|
|
|
binaryDirs
|
|
|
|
|
..addAll(_osxBinaryDirs)
|
|
|
|
|
..addAll(_linuxBinaryDirs)
|
|
|
|
|
..addAll(_windowsBinaryDirs)
|
|
|
|
|
..addAll(_androidBinaryDirs)
|
|
|
|
|
..addAll(_iosBinaryDirs)
|
|
|
|
|
..addAll(_dartSdks);
|
|
|
|
|
else if (platform.isLinux)
|
|
|
|
|
binaryDirs
|
|
|
|
|
..addAll(_linuxBinaryDirs)
|
|
|
|
|
..addAll(_androidBinaryDirs);
|
|
|
|
|
else if (platform.isMacOS)
|
|
|
|
|
binaryDirs
|
|
|
|
|
..addAll(_osxBinaryDirs)
|
|
|
|
|
..addAll(_androidBinaryDirs)
|
|
|
|
|
..addAll(_iosBinaryDirs);
|
|
|
|
|
else if (platform.isWindows)
|
|
|
|
|
binaryDirs
|
|
|
|
|
..addAll(_windowsBinaryDirs)
|
|
|
|
|
..addAll(_androidBinaryDirs);
|
|
|
|
|
|
|
|
|
|
return binaryDirs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Iterable<BinaryArtifact> _reduceEngineBinaries({
|
|
|
|
|
BuildMode buildMode,
|
|
|
|
|
TargetPlatform targetPlatform,
|
|
|
|
|
TargetPlatform hostPlatform,
|
|
|
|
|
bool skipUnknown,
|
|
|
|
|
}) sync* {
|
|
|
|
|
for (BinaryArtifact engineBinary in _binaries) {
|
|
|
|
|
if (hostPlatform != null && engineBinary.hostPlatform != null && engineBinary.hostPlatform != hostPlatform) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (engineBinary.skipChecks
|
|
|
|
|
|| engineBinary.buildMode == null && engineBinary.targetPlatform == null // match if artifact has no restrictions.
|
|
|
|
|
|| engineBinary.buildMode == buildMode && engineBinary.targetPlatform == targetPlatform // match if artifact exactly matches requiremnets.
|
|
|
|
|
|| skipUnknown && buildMode == null && targetPlatform != null && targetPlatform == engineBinary.targetPlatform // match if target platform matches but build mode is null
|
|
|
|
|
|| skipUnknown && targetPlatform == null && buildMode != null && buildMode == engineBinary.buildMode // match if build mode matches but target platform is unknown)
|
|
|
|
|
|| !skipUnknown && buildMode == null && targetPlatform == null) { // match if neither are provided but skipUnknown flag is provided.
|
|
|
|
|
yield engineBinary;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<BinaryArtifact> get _packages => const <BinaryArtifact>[
|
|
|
|
|
BinaryArtifact(
|
|
|
|
|
name: 'sky_engine',
|
|
|
|
|
fileName: 'sky_engine'
|
|
|
|
|
),
|
|
|
|
|
List<List<String>> get _osxBinaryDirs => <List<String>>[
|
|
|
|
|
<String>['darwin-x64', 'darwin-x64/artifacts.zip'],
|
|
|
|
|
<String>['android-arm-profile/darwin-x64', 'android-arm-profile/darwin-x64.zip'],
|
|
|
|
|
<String>['android-arm-release/darwin-x64', 'android-arm-release/darwin-x64.zip'],
|
|
|
|
|
<String>['android-arm64-profile/darwin-x64', 'android-arm64-profile/darwin-x64.zip'],
|
|
|
|
|
<String>['android-arm64-release/darwin-x64', 'android-arm64-release/darwin-x64.zip'],
|
|
|
|
|
<String>['android-arm-dynamic-profile/darwin-x64', 'android-arm-dynamic-profile/darwin-x64.zip'],
|
|
|
|
|
<String>['android-arm-dynamic-release/darwin-x64', 'android-arm-dynamic-release/darwin-x64.zip'],
|
|
|
|
|
<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'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/// This lives separately since we only download it when includeAllPlatforms is true.
|
|
|
|
|
List<BinaryArtifact> get _dartSdks => const <BinaryArtifact>[
|
|
|
|
|
BinaryArtifact(
|
|
|
|
|
name: 'darwin-x64',
|
|
|
|
|
fileName: 'dart-sdk-darwin-x64.zip',
|
|
|
|
|
),
|
|
|
|
|
BinaryArtifact(
|
|
|
|
|
name: 'linux-x64',
|
|
|
|
|
fileName: 'dart-sdk-linux-x64.zip',
|
|
|
|
|
),
|
|
|
|
|
BinaryArtifact(
|
|
|
|
|
name: 'windows-x64',
|
|
|
|
|
fileName: 'dart-sdk-windows-x64.zip',
|
|
|
|
|
),
|
|
|
|
|
List<List<String>> get _linuxBinaryDirs => <List<String>>[
|
|
|
|
|
<String>['linux-x64', 'linux-x64/artifacts.zip'],
|
|
|
|
|
<String>['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'],
|
|
|
|
|
<String>['android-arm-release/linux-x64', 'android-arm-release/linux-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'],
|
|
|
|
|
<String>['android-arm-dynamic-profile/linux-x64', 'android-arm-dynamic-profile/linux-x64.zip'],
|
|
|
|
|
<String>['android-arm-dynamic-release/linux-x64', 'android-arm-dynamic-release/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'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/// A set of all possible artifacts to download.
|
|
|
|
|
///
|
|
|
|
|
/// Adding a new artifact:
|
|
|
|
|
///
|
|
|
|
|
/// To ensure that we do not waste a user's time/data/storage, the flutter
|
|
|
|
|
/// tool should only binaries when they are required. These can be requested
|
|
|
|
|
/// in [FlutterCommand.updateCache].
|
|
|
|
|
///
|
|
|
|
|
/// An artifact should have the following features to prevent unecessary download:
|
|
|
|
|
///
|
|
|
|
|
/// * `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.
|
|
|
|
|
/// * `buildMode` should be one of `BuildMode.debug`, `BuildMode.profile`,
|
|
|
|
|
/// `BuildMode.release`, `BuildMode.dynamicRelease`, or
|
|
|
|
|
/// `BuildMode.dynamicProfile`. In the case where it is required regardless
|
|
|
|
|
/// of buildMode, it can be left null.
|
|
|
|
|
/// * `targetPlatform` should be one of the supported target platforms.
|
|
|
|
|
/// * If, despite the restrictions above the artifact should still be
|
|
|
|
|
/// downloaded, `skipChecks` can be set to true.
|
|
|
|
|
List<BinaryArtifact> get _binaries => const <BinaryArtifact>[
|
|
|
|
|
BinaryArtifact(
|
|
|
|
|
name: 'common',
|
|
|
|
|
fileName: 'flutter_patched_sdk.zip',
|
|
|
|
|
),
|
|
|
|
|
BinaryArtifact(
|
|
|
|
|
name: 'linux-x64',
|
|
|
|
|
fileName: 'linux-x64/artifacts.zip',
|
|
|
|
|
hostPlatform: TargetPlatform.linux_x64,
|
|
|
|
|
),
|
|
|
|
|
BinaryArtifact(
|
|
|
|
|
name: 'android-arm-profile/linux-x64',
|
|
|
|
|
fileName: 'android-arm-profile/linux-x64.zip',
|
|
|
|
|
targetPlatform: TargetPlatform.android_arm,
|
|
|
|
|
buildMode: BuildMode.profile,
|
|
|
|
|
hostPlatform: TargetPlatform.linux_x64,
|
|
|
|
|
skipChecks: true,
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
List<List<String>> get _windowsBinaryDirs => <List<String>>[
|
|
|
|
|
<String>['windows-x64', 'windows-x64/artifacts.zip'],
|
|
|
|
|
<String>['android-arm-profile/windows-x64', 'android-arm-profile/windows-x64.zip'],
|
|
|
|
|
<String>['android-arm-release/windows-x64', 'android-arm-release/windows-x64.zip'],
|
|
|
|
|
<String>['android-arm64-profile/windows-x64', 'android-arm64-profile/windows-x64.zip'],
|
|
|
|
|
<String>['android-arm64-release/windows-x64', 'android-arm64-release/windows-x64.zip'],
|
|
|
|
|
<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'],
|
|
|
|
|
<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'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
List<List<String>> get _androidBinaryDirs => <List<String>>[
|
|
|
|
|
<String>['android-x86', 'android-x86/artifacts.zip'],
|
|
|
|
|
<String>['android-x64', 'android-x64/artifacts.zip'],
|
|
|
|
|
<String>['android-arm', 'android-arm/artifacts.zip'],
|
|
|
|
|
<String>['android-arm-profile', 'android-arm-profile/artifacts.zip'],
|
|
|
|
|
<String>['android-arm-release', 'android-arm-release/artifacts.zip'],
|
|
|
|
|
<String>['android-arm64', 'android-arm64/artifacts.zip'],
|
|
|
|
|
<String>['android-arm64-profile', 'android-arm64-profile/artifacts.zip'],
|
|
|
|
|
<String>['android-arm64-release', 'android-arm64-release/artifacts.zip'],
|
|
|
|
|
<String>['android-arm-dynamic-profile', 'android-arm-dynamic-profile/artifacts.zip'],
|
|
|
|
|
<String>['android-arm-dynamic-release', 'android-arm-dynamic-release/artifacts.zip'],
|
|
|
|
|
<String>['android-arm64-dynamic-profile', 'android-arm64-dynamic-profile/artifacts.zip'],
|
|
|
|
|
<String>['android-arm64-dynamic-release', 'android-arm64-dynamic-release/artifacts.zip'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
List<List<String>> get _iosBinaryDirs => <List<String>>[
|
|
|
|
|
<String>['ios', 'ios/artifacts.zip'],
|
|
|
|
|
<String>['ios-profile', 'ios-profile/artifacts.zip'],
|
|
|
|
|
<String>['ios-release', 'ios-release/artifacts.zip'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
List<List<String>> get _dartSdks => <List<String>> [
|
|
|
|
|
<String>['darwin-x64', 'dart-sdk-darwin-x64.zip'],
|
|
|
|
|
<String>['linux-x64', 'dart-sdk-linux-x64.zip'],
|
|
|
|
|
<String>['windows-x64', 'dart-sdk-windows-x64.zip'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// A list of cache directory paths to which the LICENSE file should be copied.
|
|
|
|
|
@@ -815,63 +466,52 @@ class FlutterEngine extends CachedArtifact {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
bool isUpToDateInner({
|
|
|
|
|
BuildMode buildMode,
|
|
|
|
|
TargetPlatform targetPlatform,
|
|
|
|
|
bool skipUnknown,
|
|
|
|
|
}) {
|
|
|
|
|
bool isUpToDateInner() {
|
|
|
|
|
final Directory pkgDir = cache.getCacheDir('pkg');
|
|
|
|
|
for (BinaryArtifact packageArtifact in _packages) {
|
|
|
|
|
final Directory packageDirectory = packageArtifact.artifactLocation(pkgDir);
|
|
|
|
|
if (!packageDirectory.existsSync()) {
|
|
|
|
|
for (String pkgName in _getPackageDirs()) {
|
|
|
|
|
final String pkgPath = fs.path.join(pkgDir.path, pkgName);
|
|
|
|
|
if (!fs.directory(pkgPath).existsSync())
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (BinaryArtifact toolsArtifact in getBinaryDirs(buildMode: buildMode, targetPlatform: targetPlatform, skipUnknown: skipUnknown)) {
|
|
|
|
|
final Directory dir = toolsArtifact.artifactLocation(location);
|
|
|
|
|
if (!dir.existsSync()) {
|
|
|
|
|
|
|
|
|
|
for (List<String> toolsDir in _getBinaryDirs()) {
|
|
|
|
|
final Directory dir = fs.directory(fs.path.join(location.path, toolsDir[0]));
|
|
|
|
|
if (!dir.existsSync())
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
Future<void> updateInner({
|
|
|
|
|
@required BuildMode buildMode,
|
|
|
|
|
@required TargetPlatform targetPlatform,
|
|
|
|
|
@required bool skipUnknown,
|
|
|
|
|
@required bool clobber,
|
|
|
|
|
}) async {
|
|
|
|
|
Future<void> updateInner() async {
|
|
|
|
|
final String url = '$_storageBaseUrl/flutter_infra/flutter/$version/';
|
|
|
|
|
final Directory packageDirectory = cache.getCacheDir('pkg');
|
|
|
|
|
for (BinaryArtifact rawArtifact in _packages) {
|
|
|
|
|
final String pkgPath = fs.path.join(packageDirectory.path, rawArtifact.name);
|
|
|
|
|
|
|
|
|
|
final Directory pkgDir = cache.getCacheDir('pkg');
|
|
|
|
|
for (String pkgName in _getPackageDirs()) {
|
|
|
|
|
final String pkgPath = fs.path.join(pkgDir.path, pkgName);
|
|
|
|
|
final Directory dir = fs.directory(pkgPath);
|
|
|
|
|
final bool exists = dir.existsSync();
|
|
|
|
|
if (exists) {
|
|
|
|
|
if (!clobber) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (dir.existsSync())
|
|
|
|
|
dir.deleteSync(recursive: true);
|
|
|
|
|
}
|
|
|
|
|
final Uri uri = Uri.parse('$url${rawArtifact.name}.zip');
|
|
|
|
|
await _downloadZipArchive('Downloading package ${rawArtifact.name}...', uri, packageDirectory);
|
|
|
|
|
await _downloadZipArchive('Downloading package $pkgName...', Uri.parse(url + pkgName + '.zip'), pkgDir);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final List<BinaryArtifact> rawArtifacts = getBinaryDirs(buildMode: buildMode, targetPlatform: targetPlatform, skipUnknown: skipUnknown);
|
|
|
|
|
for (BinaryArtifact rawArtifact in rawArtifacts) {
|
|
|
|
|
final Directory artifactDirectory = rawArtifact.artifactLocation(location);
|
|
|
|
|
if (artifactDirectory.existsSync() && !clobber) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
final Uri uri = rawArtifact.artifactRemoteLocation(url);
|
|
|
|
|
await _downloadZipArchive('Downloading ${rawArtifact.name} tools...', uri, artifactDirectory);
|
|
|
|
|
_makeFilesExecutable(artifactDirectory);
|
|
|
|
|
for (List<String> toolsDir in _getBinaryDirs()) {
|
|
|
|
|
final String cacheDir = toolsDir[0];
|
|
|
|
|
final String urlPath = toolsDir[1];
|
|
|
|
|
final Directory dir = fs.directory(fs.path.join(location.path, cacheDir));
|
|
|
|
|
await _downloadZipArchive('Downloading $cacheDir tools...', Uri.parse(url + urlPath), dir);
|
|
|
|
|
|
|
|
|
|
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()) {
|
|
|
|
|
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();
|
|
|
|
|
os.unzip(frameworkZip, framework);
|
|
|
|
|
}
|
|
|
|
|
@@ -880,43 +520,43 @@ class FlutterEngine extends CachedArtifact {
|
|
|
|
|
final File licenseSource = fs.file(fs.path.join(Cache.flutterRoot, 'LICENSE'));
|
|
|
|
|
for (String licenseDir in _getLicenseDirs()) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Checks whether the remote artifacts for `engineVersion` are availible in storage.
|
|
|
|
|
Future<bool> areRemoteArtifactsAvailable({
|
|
|
|
|
String engineVersion,
|
|
|
|
|
bool includeAllPlatforms = true,
|
|
|
|
|
}) async {
|
|
|
|
|
final bool includeAllPlatforms = cache.includeAllPlatforms;
|
|
|
|
|
Future<bool> areRemoteArtifactsAvailable({String engineVersion,
|
|
|
|
|
bool includeAllPlatforms = true}) async {
|
|
|
|
|
final bool includeAllPlatformsState = cache.includeAllPlatforms;
|
|
|
|
|
cache.includeAllPlatforms = includeAllPlatforms;
|
|
|
|
|
engineVersion ??= version;
|
|
|
|
|
final String url = '$_storageBaseUrl/flutter_infra/flutter/$engineVersion/';
|
|
|
|
|
final bool result = await () async {
|
|
|
|
|
for (BinaryArtifact packageArtifact in _packages) {
|
|
|
|
|
final Uri uri = Uri.parse('$url${packageArtifact.name}.zip');
|
|
|
|
|
final bool exists = await _doesRemoteExist('Checking package ${packageArtifact.name} is available...', uri);
|
|
|
|
|
|
|
|
|
|
Future<bool> checkForArtifacts(String engineVersion) async {
|
|
|
|
|
engineVersion ??= version;
|
|
|
|
|
final String url = '$_storageBaseUrl/flutter_infra/flutter/$engineVersion/';
|
|
|
|
|
|
|
|
|
|
bool exists = false;
|
|
|
|
|
for (String pkgName in _getPackageDirs()) {
|
|
|
|
|
exists = await _doesRemoteExist('Checking package $pkgName is available...',
|
|
|
|
|
Uri.parse(url + pkgName + '.zip'));
|
|
|
|
|
if (!exists) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
final List<BinaryArtifact> rawArtifacts = getBinaryDirs(buildMode: null, targetPlatform: null, skipUnknown: false);
|
|
|
|
|
for (BinaryArtifact rawArtifact in rawArtifacts) {
|
|
|
|
|
final Uri uri = Uri.parse('$url${rawArtifact.fileName}');
|
|
|
|
|
final bool exists = await _doesRemoteExist('Checking ${rawArtifact.name} tools are available...', uri);
|
|
|
|
|
|
|
|
|
|
for (List<String> toolsDir in _getBinaryDirs()) {
|
|
|
|
|
final String cacheDir = toolsDir[0];
|
|
|
|
|
final String urlPath = toolsDir[1];
|
|
|
|
|
exists = await _doesRemoteExist('Checking $cacheDir tools are available...',
|
|
|
|
|
Uri.parse(url + urlPath));
|
|
|
|
|
if (!exists) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}();
|
|
|
|
|
cache.includeAllPlatforms = includeAllPlatforms;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final bool result = await checkForArtifacts(engineVersion);
|
|
|
|
|
cache.includeAllPlatforms = includeAllPlatformsState;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -925,9 +565,8 @@ class FlutterEngine extends CachedArtifact {
|
|
|
|
|
for (FileSystemEntity entity in dir.listSync()) {
|
|
|
|
|
if (entity is File) {
|
|
|
|
|
final String name = fs.path.basename(entity.path);
|
|
|
|
|
if (name == 'flutter_tester') {
|
|
|
|
|
if (name == 'flutter_tester')
|
|
|
|
|
os.makeExecutable(entity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -942,20 +581,18 @@ class GradleWrapper extends CachedArtifact {
|
|
|
|
|
String get _gradleWrapper => fs.path.join('gradle', 'wrapper', 'gradle-wrapper.jar');
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> updateInner({BuildMode buildMode, TargetPlatform targetPlatform, bool skipUnknown, bool clobber}) async {
|
|
|
|
|
Future<void> updateInner() {
|
|
|
|
|
final Uri archiveUri = _toStorageUri(version);
|
|
|
|
|
if (fs.directory(location).listSync().isEmpty || clobber) {
|
|
|
|
|
await _downloadZippedTarball('Downloading Gradle Wrapper...', archiveUri, location).then<void>((_) {
|
|
|
|
|
// Delete property file, allowing templates to provide it.
|
|
|
|
|
fs.file(fs.path.join(location.path, 'gradle', 'wrapper', 'gradle-wrapper.properties')).deleteSync();
|
|
|
|
|
// Remove NOTICE file. Should not be part of the template.
|
|
|
|
|
fs.file(fs.path.join(location.path, 'NOTICE')).deleteSync();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return _downloadZippedTarball('Downloading Gradle Wrapper...', archiveUri, location).then<void>((_) {
|
|
|
|
|
// Delete property file, allowing templates to provide it.
|
|
|
|
|
fs.file(fs.path.join(location.path, 'gradle', 'wrapper', 'gradle-wrapper.properties')).deleteSync();
|
|
|
|
|
// Remove NOTICE file. Should not be part of the template.
|
|
|
|
|
fs.file(fs.path.join(location.path, 'NOTICE')).deleteSync();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
bool isUpToDateInner({BuildMode buildMode, TargetPlatform targetPlatform, bool skipUnknown}) {
|
|
|
|
|
bool isUpToDateInner() {
|
|
|
|
|
final Directory wrapperDir = cache.getCacheDir(fs.path.join('artifacts', 'gradle_wrapper'));
|
|
|
|
|
if (!fs.directory(wrapperDir).existsSync())
|
|
|
|
|
return false;
|
|
|
|
|
@@ -1022,34 +659,3 @@ void _ensureExists(Directory directory) {
|
|
|
|
|
if (!directory.existsSync())
|
|
|
|
|
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';
|
|
|
|
|
}
|
|
|
|
|
|