port devicelab from idevice_id -> xcdevices (#59907)
This commit is contained in:
parent
8b79bb97de
commit
ca32668b0b
@ -62,7 +62,6 @@ bool checkCacheIsCurrent() {
|
||||
}
|
||||
|
||||
List<String> get binariesWithEntitlements => List<String>.unmodifiable(<String>[
|
||||
'idevice_id',
|
||||
'ideviceinfo',
|
||||
'idevicename',
|
||||
'idevicescreenshot',
|
||||
|
@ -551,29 +551,49 @@ class IosDeviceDiscovery implements DeviceDiscovery {
|
||||
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
|
||||
Future<List<String>> discoverDevices() async {
|
||||
final String ideviceIdPath = path.join(getArtifactPath(), 'libimobiledevice', 'idevice_id');
|
||||
final List<String> iosDeviceIDs = LineSplitter.split(await eval(ideviceIdPath, <String>['-l'], environment: _ideviceIdEnvironment))
|
||||
.map<String>((String line) => line.trim())
|
||||
.where((String line) => line.isNotEmpty)
|
||||
.toList();
|
||||
if (iosDeviceIDs.isEmpty)
|
||||
final List<dynamic> results = json.decode(await eval(
|
||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||
<String>['devices', '--machine', '--suppress-analytics'],
|
||||
)) as List<dynamic>;
|
||||
|
||||
// [
|
||||
// {
|
||||
// "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.');
|
||||
return iosDeviceIDs;
|
||||
}
|
||||
return deviceIds;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -819,7 +819,7 @@ abstract class FlutterCommand extends Command<void> {
|
||||
// sky_engine package is available in the flutter cache for pub to find.
|
||||
if (shouldUpdateCache) {
|
||||
// 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(await requiredArtifacts);
|
||||
|
Loading…
x
Reference in New Issue
Block a user