readIosSetup function
Future<DeviceSetup>
readIosSetup(
- String udid,
- int? xcodeMajor, {
- String transport = 'indigo',
- ProcessRunner run = boundedRun,
iOS runtime of simulator udid and the Mac's macOS major; transport is the bridge's input path.
Implementation
Future<DeviceSetup> readIosSetup(String udid, int? xcodeMajor,
{String transport = 'indigo', ProcessRunner run = boundedRun}) async {
String? runtime;
int? runtimeMajor;
try {
final r = await runCapped(
run,
'xcrun',
['simctl', 'list', 'devices', '-j'],
timeout: const Duration(seconds: 10),
phase: 'simctl list devices',
);
final devices = (jsonDecode(r.stdout as String) as Map)['devices'] as Map;
for (final entry in devices.entries) {
if ((entry.value as List).any((d) => d is Map && d['udid'] == udid)) {
final m = RegExp(r'SimRuntime\.iOS-(\d+)-(\d+)').firstMatch(entry.key as String);
if (m != null) {
runtimeMajor = int.parse(m.group(1)!);
runtime = 'iOS ${m.group(1)}.${m.group(2)}';
}
}
}
} on Object {
// unknown runtime: judged as untested
}
return (
platform: 'ios',
backend: transport,
runtimeMajor: runtimeMajor,
runtime: runtime,
xcodeMajor: xcodeMajor,
hostMajor: await _hostMajor(run),
);
}