diff --git a/dev/bots/codesign.dart b/dev/bots/codesign.dart index d687d3de88..feadabad5d 100644 --- a/dev/bots/codesign.dart +++ b/dev/bots/codesign.dart @@ -62,7 +62,6 @@ bool checkCacheIsCurrent() { } List get binariesWithEntitlements => List.unmodifiable([ - 'idevice_id', 'ideviceinfo', 'idevicename', 'idevicescreenshot', diff --git a/dev/devicelab/lib/framework/adb.dart b/dev/devicelab/lib/framework/adb.dart index 959983c541..55df99aa39 100644 --- a/dev/devicelab/lib/framework/adb.dart +++ b/dev/devicelab/lib/framework/adb.dart @@ -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 get _ideviceIdEnvironment { - final String libPath = const [ - 'libimobiledevice', - 'usbmuxd', - 'libplist', - 'openssl', - 'ios-deploy', - ].map((String packageName) => path.join(getArtifactPath(), packageName)).join(':'); - return {'DYLD_LIBRARY_PATH': libPath}; - } - @override Future> discoverDevices() async { - final String ideviceIdPath = path.join(getArtifactPath(), 'libimobiledevice', 'idevice_id'); - final List iosDeviceIDs = LineSplitter.split(await eval(ideviceIdPath, ['-l'], environment: _ideviceIdEnvironment)) - .map((String line) => line.trim()) - .where((String line) => line.isNotEmpty) - .toList(); - if (iosDeviceIDs.isEmpty) + final List results = json.decode(await eval( + path.join(flutterDirectory.path, 'bin', 'flutter'), + ['devices', '--machine', '--suppress-analytics'], + )) as List; + + // [ + // { + // "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 deviceIds = []; + + for (final dynamic result in results) { + final Map device = result as Map; + 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 diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index 9ec5e296b6..baeaa4c85c 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -819,7 +819,7 @@ abstract class FlutterCommand extends Command { // 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.universal}); await globals.cache.updateAll(await requiredArtifacts);