Commit 3e265e9e authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Revert "Lazily initialise Xcode installation status (#10945)" (#10951)

This reverts commit bb8e2a7c.

Triggers a doctor failure on the Mac chromebots.
parent bb8e2a7c
...@@ -80,58 +80,54 @@ class IMobileDevice { ...@@ -80,58 +80,54 @@ class IMobileDevice {
} }
class Xcode { class Xcode {
bool get isInstalledAndMeetsVersionCheck => isInstalled && xcodeVersionSatisfactory; Xcode() {
_eulaSigned = false;
String _xcodeSelectPath; try {
String get xcodeSelectPath { _xcodeSelectPath = runSync(<String>['xcode-select', '--print-path'])?.trim();
if (_xcodeSelectPath == null) { if (_xcodeSelectPath == null || _xcodeSelectPath.isEmpty) {
try { _isInstalled = false;
_xcodeSelectPath = runSync(<String>['/usr/bin/xcode-select', '--print-path'])?.trim(); return;
} on ProcessException {
// Ignore: return null below.
} }
_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 { bool get isInstalledAndMeetsVersionCheck => isInstalled && xcodeVersionSatisfactory;
if (xcodeSelectPath == null || xcodeSelectPath.isEmpty)
return false; String _xcodeSelectPath;
if (!xcodeVersionRegex.hasMatch(xcodeVersionText)) String get xcodeSelectPath => _xcodeSelectPath;
return false;
return true; bool _isInstalled;
} bool get isInstalled => _isInstalled;
bool _eulaSigned; bool _eulaSigned;
/// Has the EULA been signed? /// Has the EULA been signed?
bool get eulaSigned { bool get eulaSigned => _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;
}
String _xcodeVersionText; String _xcodeVersionText;
String get xcodeVersionText { String get xcodeVersionText => _xcodeVersionText;
if (_xcodeVersionText != null) {
try {
_xcodeVersionText = runSync(<String>['/usr/bin/xcodebuild', '-version']).replaceAll('\n', ', ');
} on ProcessException {
// Ignore: return null below.
}
}
return _xcodeVersionText;
}
int _xcodeMajorVersion; int _xcodeMajorVersion;
int get xcodeMajorVersion => _xcodeMajorVersion; int get xcodeMajorVersion => _xcodeMajorVersion;
......
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