Unverified Commit ca32668b authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

port devicelab from idevice_id -> xcdevices (#59907)

parent 8b79bb97
...@@ -62,7 +62,6 @@ bool checkCacheIsCurrent() { ...@@ -62,7 +62,6 @@ bool checkCacheIsCurrent() {
} }
List<String> get binariesWithEntitlements => List<String>.unmodifiable(<String>[ List<String> get binariesWithEntitlements => List<String>.unmodifiable(<String>[
'idevice_id',
'ideviceinfo', 'ideviceinfo',
'idevicename', 'idevicename',
'idevicescreenshot', 'idevicescreenshot',
......
...@@ -551,29 +551,49 @@ class IosDeviceDiscovery implements DeviceDiscovery { ...@@ -551,29 +551,49 @@ class IosDeviceDiscovery implements DeviceDiscovery {
print('Device chosen: $_workingDevice'); print('Device chosen: $_workingDevice');
} }
// Returns a colon-separated environment variable that contains the paths
// of linked libraries for idevice_id
Map<String, String> get _ideviceIdEnvironment {
final String libPath = const <String>[
'libimobiledevice',
'usbmuxd',
'libplist',
'openssl',
'ios-deploy',
].map((String packageName) => path.join(getArtifactPath(), packageName)).join(':');
return <String, String>{'DYLD_LIBRARY_PATH': libPath};
}
@override @override
Future<List<String>> discoverDevices() async { Future<List<String>> discoverDevices() async {
final String ideviceIdPath = path.join(getArtifactPath(), 'libimobiledevice', 'idevice_id'); final List<dynamic> results = json.decode(await eval(
final List<String> iosDeviceIDs = LineSplitter.split(await eval(ideviceIdPath, <String>['-l'], environment: _ideviceIdEnvironment)) path.join(flutterDirectory.path, 'bin', 'flutter'),
.map<String>((String line) => line.trim()) <String>['devices', '--machine', '--suppress-analytics'],
.where((String line) => line.isNotEmpty) )) as List<dynamic>;
.toList();
if (iosDeviceIDs.isEmpty) // [
// {
// "name": "Flutter's iPhone",
// "id": "00008020-00017DA80CC1002E",
// "isSupported": true,
// "targetPlatform": "ios",
// "emulator": false,
// "sdk": "iOS 13.2",
// "capabilities": {
// "hotReload": true,
// "hotRestart": true,
// "screenshot": true,
// "fastStart": false,
// "flutterExit": true,
// "hardwareRendering": false,
// "startPaused": false
// }
// }
// ]
final List<String> deviceIds = <String>[];
for (final dynamic result in results) {
final Map<String, dynamic> device = result as Map<String, dynamic>;
if (device['targetPlatform'] == 'ios' &&
device['id'] != null &&
device['emulator'] != true &&
device['isSupported'] == true) {
deviceIds.add(device['id'] as String);
}
}
if (deviceIds.isEmpty) {
throw const DeviceException('No connected iOS devices found.'); throw const DeviceException('No connected iOS devices found.');
return iosDeviceIDs; }
return deviceIds;
} }
@override @override
......
...@@ -819,7 +819,7 @@ abstract class FlutterCommand extends Command<void> { ...@@ -819,7 +819,7 @@ abstract class FlutterCommand extends Command<void> {
// sky_engine package is available in the flutter cache for pub to find. // sky_engine package is available in the flutter cache for pub to find.
if (shouldUpdateCache) { if (shouldUpdateCache) {
// First always update universal artifacts, as some of these (e.g. // First always update universal artifacts, as some of these (e.g.
// idevice_id on macOS) are required to determine `requiredArtifacts`. // ios-deploy on macOS) are required to determine `requiredArtifacts`.
await globals.cache.updateAll(<DevelopmentArtifact>{DevelopmentArtifact.universal}); await globals.cache.updateAll(<DevelopmentArtifact>{DevelopmentArtifact.universal});
await globals.cache.updateAll(await requiredArtifacts); await globals.cache.updateAll(await requiredArtifacts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment