check if libimobiledevice executables exist (#43767)

This commit is contained in:
Jonah Williams
2019-10-29 21:35:51 -07:00
committed by GitHub
parent 28a214ba8a
commit 50da3bd062
2 changed files with 61 additions and 1 deletions

View File

@@ -1103,6 +1103,17 @@ class IosUsbArtifacts extends CachedArtifact {
'libzip',
];
// For unknown reasons, users are getting into bad states where libimobiledevice is
// downloaded but some executables are missing from the zip. The names here are
// used for additional download checks below, so we can redownload if they are
// missing.
static const Map<String, List<String>> _kExecutables = <String, List<String>>{
'libimobiledevice': <String>[
'idevice_id',
'ideviceinfo',
],
};
@override
Map<String, String> get environment {
return <String, String>{
@@ -1110,11 +1121,28 @@ class IosUsbArtifacts extends CachedArtifact {
};
}
@override
bool isUpToDateInner() {
final List<String> executables =_kExecutables[name];
if (executables == null) {
return true;
}
for (String executable in executables) {
if (!location.childFile(executable).existsSync()) {
return false;
}
}
return true;
}
@override
Future<void> updateInner() {
if (!platform.isMacOS && !cache.includeAllPlatforms) {
return Future<void>.value();
}
if (location.existsSync()) {
location.deleteSync(recursive: true);
}
return _downloadZipArchive('Downloading $name...', archiveUri, location);
}