Skip to content

Commit

Permalink
Revert "Lazily initialise Xcode installation status (flutter#10945)" (f…
Browse files Browse the repository at this point in the history
…lutter#10951)

This reverts commit bb8e2a7.

Triggers a doctor failure on the Mac chromebots.
  • Loading branch information
cbracken authored Jun 23, 2017
1 parent bb8e2a7 commit 3e265e9
Showing 1 changed file with 38 additions and 42 deletions.
80 changes: 38 additions & 42 deletions packages/flutter_tools/lib/src/ios/mac.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,58 +80,54 @@ class IMobileDevice {
}

class Xcode {
bool get isInstalledAndMeetsVersionCheck => isInstalled && xcodeVersionSatisfactory;
Xcode() {
_eulaSigned = false;

String _xcodeSelectPath;
String get xcodeSelectPath {
if (_xcodeSelectPath == null) {
try {
_xcodeSelectPath = runSync(<String>['/usr/bin/xcode-select', '--print-path'])?.trim();
} on ProcessException {
// Ignore: return null below.
try {
_xcodeSelectPath = runSync(<String>['xcode-select', '--print-path'])?.trim();
if (_xcodeSelectPath == null || _xcodeSelectPath.isEmpty) {
_isInstalled = false;
return;
}
_isInstalled = true;

_xcodeVersionText = runSync(<String>['xcodebuild', '-version']).replaceAll('\n', ', ');

if (!xcodeVersionRegex.hasMatch(_xcodeVersionText)) {
_isInstalled = false;
} else {
try {
final ProcessResult result = processManager.runSync(<String>['/usr/bin/xcrun', '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) {
_eulaSigned = false;
}
}
} catch (error) {
_isInstalled = false;
}
return _xcodeSelectPath;
}

bool get isInstalled {
if (xcodeSelectPath == null || xcodeSelectPath.isEmpty)
return false;
if (!xcodeVersionRegex.hasMatch(xcodeVersionText))
return false;
return true;
}
bool get isInstalledAndMeetsVersionCheck => isInstalled && xcodeVersionSatisfactory;

String _xcodeSelectPath;
String get xcodeSelectPath => _xcodeSelectPath;

bool _isInstalled;
bool get isInstalled => _isInstalled;

bool _eulaSigned;
/// Has the EULA been signed?
bool get eulaSigned {
if (_eulaSigned == null) {
try {
final ProcessResult result = processManager.runSync(<String>['/usr/bin/xcrun', '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;
} on ProcessException {
_eulaSigned = false;
}
}
return _eulaSigned;
}
bool get eulaSigned => _eulaSigned;

String _xcodeVersionText;
String get xcodeVersionText {
if (_xcodeVersionText != null) {
try {
_xcodeVersionText = runSync(<String>['/usr/bin/xcodebuild', '-version']).replaceAll('\n', ', ');
} on ProcessException {
// Ignore: return null below.
}
}
return _xcodeVersionText;
}
String get xcodeVersionText => _xcodeVersionText;

int _xcodeMajorVersion;
int get xcodeMajorVersion => _xcodeMajorVersion;
Expand Down

0 comments on commit 3e265e9

Please sign in to comment.