Commit 38840776 authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Improve doctor reporting for iOS toolchain (#6289)

Previously, overall status was reported as good if Xcode and homebrew
were installed, even if there were issues with either of the tools. We
now report partial status if we detect issues with either installation.
parent 2c41a400
...@@ -32,11 +32,12 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -32,11 +32,12 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
@override @override
Future<ValidationResult> validate() async { Future<ValidationResult> validate() async {
List<ValidationMessage> messages = <ValidationMessage>[]; List<ValidationMessage> messages = <ValidationMessage>[];
int installCount = 0; ValidationType xcodeStatus = ValidationType.missing;
ValidationType brewStatus = ValidationType.missing;
String xcodeVersionInfo; String xcodeVersionInfo;
if (xcode.isInstalled) { if (xcode.isInstalled) {
installCount++; xcodeStatus = ValidationType.installed;
messages.add(new ValidationMessage('XCode at ${xcode.xcodeSelectPath}')); messages.add(new ValidationMessage('XCode at ${xcode.xcodeSelectPath}'));
...@@ -46,6 +47,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -46,6 +47,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
messages.add(new ValidationMessage(xcode.xcodeVersionText)); messages.add(new ValidationMessage(xcode.xcodeVersionText));
if (!xcode.isInstalledAndMeetsVersionCheck) { if (!xcode.isInstalledAndMeetsVersionCheck) {
xcodeStatus = ValidationType.partial;
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'Flutter requires a minimum XCode version of $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor.0.\n' 'Flutter requires a minimum XCode version of $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor.0.\n'
'Download the latest version or update via the Mac App Store.' 'Download the latest version or update via the Mac App Store.'
...@@ -53,11 +55,13 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -53,11 +55,13 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
} }
if (!xcode.eulaSigned) { if (!xcode.eulaSigned) {
xcodeStatus = ValidationType.partial;
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'XCode end user license agreement not signed; open XCode or run the command \'sudo xcodebuild -license\'.' 'XCode end user license agreement not signed; open XCode or run the command \'sudo xcodebuild -license\'.'
)); ));
} }
} else { } else {
xcodeStatus = ValidationType.missing;
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'XCode not installed; this is necessary for iOS development.\n' 'XCode not installed; this is necessary for iOS development.\n'
'Download at https://developer.apple.com/xcode/download/.' 'Download at https://developer.apple.com/xcode/download/.'
...@@ -66,9 +70,10 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -66,9 +70,10 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
// brew installed // brew installed
if (os.which('brew') != null) { if (os.which('brew') != null) {
installCount++; brewStatus = ValidationType.installed;
if (!exitsHappy(<String>['ideviceinstaller', '-h'])) { if (!exitsHappy(<String>['ideviceinstaller', '-h'])) {
brewStatus = ValidationType.partial;
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'ideviceinstaller not available; this is used to discover connected iOS devices.\n' 'ideviceinstaller not available; this is used to discover connected iOS devices.\n'
'Install via \'brew install ideviceinstaller\'.' 'Install via \'brew install ideviceinstaller\'.'
...@@ -76,6 +81,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -76,6 +81,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
} }
if (!hasIDeviceId) { if (!hasIDeviceId) {
brewStatus = ValidationType.partial;
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'ios-deploy not available; this is used to deploy to connected iOS devices.\n' 'ios-deploy not available; this is used to deploy to connected iOS devices.\n'
'Install via \'brew install ios-deploy\'.' 'Install via \'brew install ios-deploy\'.'
...@@ -85,6 +91,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -85,6 +91,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
// TODO(cbracken) remove this check once libimobiledevice > 1.2.0 is released. // TODO(cbracken) remove this check once libimobiledevice > 1.2.0 is released.
ProcessResult result = (await runAsync(<String>['idevice_id', '-l'])).processResult; ProcessResult result = (await runAsync(<String>['idevice_id', '-l'])).processResult;
if (result.exitCode == 0 && result.stdout.isNotEmpty && !exitsHappy(<String>['ideviceName'])) { if (result.exitCode == 0 && result.stdout.isNotEmpty && !exitsHappy(<String>['ideviceName'])) {
brewStatus = ValidationType.partial;
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'libimobiledevice is incompatible with the installed XCode version. To update, run:\n' 'libimobiledevice is incompatible with the installed XCode version. To update, run:\n'
'brew uninstall libimobiledevice\n' 'brew uninstall libimobiledevice\n'
...@@ -93,6 +100,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -93,6 +100,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
} }
} }
} else { } else {
brewStatus = ValidationType.missing;
messages.add(new ValidationMessage.error( messages.add(new ValidationMessage.error(
'Brew not installed; use this to install tools for iOS device development.\n' 'Brew not installed; use this to install tools for iOS device development.\n'
'Download brew at http://brew.sh/.' 'Download brew at http://brew.sh/.'
...@@ -100,7 +108,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { ...@@ -100,7 +108,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow {
} }
return new ValidationResult( return new ValidationResult(
installCount == 2 ? ValidationType.installed : installCount == 1 ? ValidationType.partial : ValidationType.missing, xcodeStatus == brewStatus ? xcodeStatus : ValidationType.partial,
messages, messages,
statusInfo: xcodeVersionInfo statusInfo: xcodeVersionInfo
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment