From 3884077609af4a4e3e3e9e652ecc9d72bc60b2db Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 12 Oct 2016 14:19:31 -0700 Subject: [PATCH] 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. --- .../flutter_tools/lib/src/ios/ios_workflow.dart | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/flutter_tools/lib/src/ios/ios_workflow.dart b/packages/flutter_tools/lib/src/ios/ios_workflow.dart index 1e79bfad38..e2f9096ce3 100644 --- a/packages/flutter_tools/lib/src/ios/ios_workflow.dart +++ b/packages/flutter_tools/lib/src/ios/ios_workflow.dart @@ -32,11 +32,12 @@ class IOSWorkflow extends DoctorValidator implements Workflow { @override Future validate() async { List messages = []; - int installCount = 0; + ValidationType xcodeStatus = ValidationType.missing; + ValidationType brewStatus = ValidationType.missing; String xcodeVersionInfo; if (xcode.isInstalled) { - installCount++; + xcodeStatus = ValidationType.installed; messages.add(new ValidationMessage('XCode at ${xcode.xcodeSelectPath}')); @@ -46,6 +47,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { messages.add(new ValidationMessage(xcode.xcodeVersionText)); if (!xcode.isInstalledAndMeetsVersionCheck) { + xcodeStatus = ValidationType.partial; messages.add(new ValidationMessage.error( 'Flutter requires a minimum XCode version of $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor.0.\n' 'Download the latest version or update via the Mac App Store.' @@ -53,11 +55,13 @@ class IOSWorkflow extends DoctorValidator implements Workflow { } if (!xcode.eulaSigned) { + xcodeStatus = ValidationType.partial; messages.add(new ValidationMessage.error( 'XCode end user license agreement not signed; open XCode or run the command \'sudo xcodebuild -license\'.' )); } } else { + xcodeStatus = ValidationType.missing; messages.add(new ValidationMessage.error( 'XCode not installed; this is necessary for iOS development.\n' 'Download at https://developer.apple.com/xcode/download/.' @@ -66,9 +70,10 @@ class IOSWorkflow extends DoctorValidator implements Workflow { // brew installed if (os.which('brew') != null) { - installCount++; + brewStatus = ValidationType.installed; if (!exitsHappy(['ideviceinstaller', '-h'])) { + brewStatus = ValidationType.partial; messages.add(new ValidationMessage.error( 'ideviceinstaller not available; this is used to discover connected iOS devices.\n' 'Install via \'brew install ideviceinstaller\'.' @@ -76,6 +81,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { } if (!hasIDeviceId) { + brewStatus = ValidationType.partial; messages.add(new ValidationMessage.error( 'ios-deploy not available; this is used to deploy to connected iOS devices.\n' 'Install via \'brew install ios-deploy\'.' @@ -85,6 +91,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { // TODO(cbracken) remove this check once libimobiledevice > 1.2.0 is released. ProcessResult result = (await runAsync(['idevice_id', '-l'])).processResult; if (result.exitCode == 0 && result.stdout.isNotEmpty && !exitsHappy(['ideviceName'])) { + brewStatus = ValidationType.partial; messages.add(new ValidationMessage.error( 'libimobiledevice is incompatible with the installed XCode version. To update, run:\n' 'brew uninstall libimobiledevice\n' @@ -93,6 +100,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { } } } else { + brewStatus = ValidationType.missing; messages.add(new ValidationMessage.error( 'Brew not installed; use this to install tools for iOS device development.\n' 'Download brew at http://brew.sh/.' @@ -100,7 +108,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { } return new ValidationResult( - installCount == 2 ? ValidationType.installed : installCount == 1 ? ValidationType.partial : ValidationType.missing, + xcodeStatus == brewStatus ? xcodeStatus : ValidationType.partial, messages, statusInfo: xcodeVersionInfo );