Use idevice_id for devicelab iOS device lookups (#13652)
This replaces the use of ideviceinfo (whose output was then filtered for device IDs) with an invocation idevice_id -l, which returns the list directly, one per line.
This commit is contained in:
parent
68bf4b3c62
commit
b771294c16
@ -3,6 +3,7 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
@ -309,13 +310,12 @@ class IosDeviceDiscovery implements DeviceDiscovery {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<String>> discoverDevices() async {
|
Future<List<String>> discoverDevices() async {
|
||||||
// TODO(yjbanov): use the -k UniqueDeviceID option, which requires much less parsing.
|
final List<String> iosDeviceIDs = LineSplitter.split(await eval('idevice_id', <String>['-l']))
|
||||||
final List<String> iosDeviceIDs = grep('UniqueDeviceID', from: await eval('ideviceinfo', <String>[]))
|
.map((String line) => line.trim())
|
||||||
.map((String line) => line.split(' ').last).toList();
|
.where((String line) => line.isNotEmpty)
|
||||||
|
.toList();
|
||||||
if (iosDeviceIDs.isEmpty)
|
if (iosDeviceIDs.isEmpty)
|
||||||
throw 'No connected iOS devices found.';
|
throw 'No connected iOS devices found.';
|
||||||
|
|
||||||
return iosDeviceIDs;
|
return iosDeviceIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user