several fixes to the doctor command
diff --git a/packages/flutter_tools/lib/src/ios/ios_workflow.dart b/packages/flutter_tools/lib/src/ios/ios_workflow.dart
index 8df90c7..337026a 100644
--- a/packages/flutter_tools/lib/src/ios/ios_workflow.dart
+++ b/packages/flutter_tools/lib/src/ios/ios_workflow.dart
@@ -4,6 +4,7 @@
import 'dart:io';
+import '../base/os.dart';
import '../base/process.dart';
import '../doctor.dart';
import 'mac.dart';
@@ -36,10 +37,11 @@
if (xcode.isInstalled) {
installCount++;
+ messages.add(new ValidationMessage('XCode at ${xcode.xcodeSelectPath}'));
+
xcodeVersionInfo = xcode.xcodeVersionText;
if (xcodeVersionInfo.contains(','))
xcodeVersionInfo = xcodeVersionInfo.substring(0, xcodeVersionInfo.indexOf(','));
-
messages.add(new ValidationMessage(xcode.xcodeVersionText));
if (!xcode.isInstalledAndMeetsVersionCheck) {
@@ -62,18 +64,14 @@
}
// brew installed
- if (exitsHappy(<String>['brew', '-v'])) {
+ if (os.which('brew') != null) {
installCount++;
- List<String> installed = <String>[];
-
if (!exitsHappy(<String>['ideviceinstaller', '-h'])) {
messages.add(new ValidationMessage.error(
'ideviceinstaller not available; this is used to discover connected iOS devices.\n'
'Install via \'brew install ideviceinstaller\'.'
));
- } else {
- installed.add('ideviceinstaller');
}
if (!hasIDeviceId) {
@@ -81,12 +79,7 @@
'ios-deploy not available; this is used to deploy to connected iOS devices.\n'
'Install via \'brew install ios-deploy\'.'
));
- } else {
- installed.add('ios-deploy');
}
-
- if (installed.isNotEmpty)
- messages.add(new ValidationMessage(installed.join(', ') + ' installed'));
} else {
messages.add(new ValidationMessage.error(
'Brew not installed; use this to install tools for iOS device development.\n'
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 388cc12..fd1db37 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -22,45 +22,49 @@
const int kXcodeRequiredVersionMinor = 0;
class XCode {
+ XCode() {
+ _eulaSigned = false;
+
+ try {
+ _xcodeSelectPath = runSync(<String>['xcode-select', '--print-path']);
+ _isInstalled = true;
+
+ _xcodeVersionText = runSync(<String>['xcodebuild', '-version']).replaceAll('\n', ', ');
+
+ try {
+ printTrace('xcrun clang');
+
+ ProcessResult result = Process.runSync('/usr/bin/xcrun', <String>['clang']);
+ if (result.stdout != null && result.stdout.contains('license'))
+ _eulaSigned = false;
+ else if (result.stderr != null && result.stderr.contains('license'))
+ _eulaSigned = false;
+ else
+ _eulaSigned = true;
+ } catch (error) {
+ }
+ } catch (error) {
+ _isInstalled = false;
+ }
+ }
+
/// Returns [XCode] active in the current app context.
static XCode get instance => context[XCode] ?? (context[XCode] = new XCode());
bool get isInstalledAndMeetsVersionCheck => isInstalled && xcodeVersionSatisfactory;
+ String _xcodeSelectPath;
+ String get xcodeSelectPath => _xcodeSelectPath;
+
bool _isInstalled;
- bool get isInstalled {
- if (_isInstalled != null) {
- return _isInstalled;
- }
+ bool get isInstalled => _isInstalled;
- _isInstalled = exitsHappy(<String>['xcode-select', '--print-path']);
- return _isInstalled;
- }
-
+ bool _eulaSigned;
/// Has the EULA been signed?
- bool get eulaSigned {
- if (!isInstalled)
- return false;
-
- try {
- ProcessResult result = Process.runSync('/usr/bin/xcrun', <String>['clang']);
- if (result.stdout != null && result.stdout.contains('license'))
- return false;
- if (result.stderr != null && result.stderr.contains('license'))
- return false;
- return true;
- } catch (error) {
- return false;
- }
- }
+ bool get eulaSigned => _eulaSigned;
String _xcodeVersionText;
-
- String get xcodeVersionText {
- if (_xcodeVersionText == null)
- _xcodeVersionText = runSync(<String>['xcodebuild', '-version']).replaceAll('\n', ', ');
- return _xcodeVersionText;
- }
+ String get xcodeVersionText => _xcodeVersionText;
bool get xcodeVersionSatisfactory {
RegExp regex = new RegExp(r'Xcode ([0-9.]+)');