Fail ios workflow when simctl does not work (#15628) * fail ios workflow when simctl does not work * missed rename commit * address comments
diff --git a/packages/flutter_tools/lib/src/ios/ios_workflow.dart b/packages/flutter_tools/lib/src/ios/ios_workflow.dart index 55b5ed3..d561ff0 100644 --- a/packages/flutter_tools/lib/src/ios/ios_workflow.dart +++ b/packages/flutter_tools/lib/src/ios/ios_workflow.dart
@@ -23,7 +23,7 @@ // We need xcode (+simctl) to list simulator devices, and libimobiledevice to list real devices. @override - bool get canListDevices => xcode.isInstalledAndMeetsVersionCheck; + bool get canListDevices => xcode.isInstalledAndMeetsVersionCheck && xcode.isSimctlInstalled; // We need xcode to launch simulator devices, and ideviceinstaller and ios-deploy // for real devices. @@ -87,6 +87,13 @@ 'Xcode end user license agreement not signed; open Xcode or run the command \'sudo xcodebuild -license\'.' )); } + if (!xcode.isSimctlInstalled) { + xcodeStatus = ValidationType.partial; + messages.add(new ValidationMessage.error( + 'Xcode requires additional components to be installed in order to run.\n' + 'Launch Xcode and install additional required components when prompted.' + )); + } if ((await macDevMode).contains('disabled')) { xcodeStatus = ValidationType.partial; messages.add(new ValidationMessage.error(
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart index 29bf8c8..aff5667 100644 --- a/packages/flutter_tools/lib/src/ios/mac.dart +++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -149,6 +149,23 @@ return _eulaSigned; } + bool _isSimctlInstalled; + + /// Verifies that simctl is installed by trying to run it. + bool get isSimctlInstalled { + if (_isSimctlInstalled == null) { + try { + // This command will error if additional components need to be installed in + // xcode 9.2 and above. + final ProcessResult result = processManager.runSync(<String>['/usr/bin/xcrun', 'simctl', 'list']); + _isSimctlInstalled = result.stderr == null; + } on ProcessException { + _isSimctlInstalled = false; + } + } + return _isSimctlInstalled; + } + bool get isVersionSatisfactory { if (!xcodeProjectInterpreter.isInstalled) return false;