Commit 16f9e387 authored by Devon Carew's avatar Devon Carew

check to see if the xcode eula has been signed

parent 4ec96084
......@@ -28,15 +28,7 @@ class IOSWorkflow extends Workflow {
);
Function _xcodeExists = () {
if (xcode.isInstalledAndMeetsVersionCheck) {
return ValidationType.installed;
}
if (xcode.isInstalled) {
return ValidationType.partial;
}
return ValidationType.missing;
return xcode.isInstalled ? ValidationType.installed : ValidationType.missing;
};
Function _xcodeVersionSatisfactory = () {
......@@ -47,6 +39,10 @@ class IOSWorkflow extends Workflow {
return ValidationType.missing;
};
Function _xcodeEulaSigned = () {
return xcode.eulaSigned ? ValidationType.installed : ValidationType.missing;
};
Function _brewExists = () {
return exitsHappy(<String>['brew', '-v'])
? ValidationType.installed : ValidationType.missing;
......@@ -71,12 +67,19 @@ class IOSWorkflow extends Workflow {
iosValidator.addValidator(xcodeValidator);
xcodeValidator.addValidator(new Validator(
'Version Check',
description: 'Xcode version is at least $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor',
'version',
description: 'Xcode minimum version of $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor.0',
resolution: 'Download the latest version or update via the Mac App Store',
validatorFunction: _xcodeVersionSatisfactory
));
xcodeValidator.addValidator(new Validator(
'EULA',
description: 'XCode end user license agreement',
resolution: "Open XCode or run the command 'sudo xcodebuild -license'",
validatorFunction: _xcodeEulaSigned
));
Validator brewValidator = new Validator(
'brew',
description: 'install additional development packages',
......
......@@ -40,6 +40,23 @@ class XCode {
return _isInstalled;
}
/// 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 _xcodeVersionSatisfactory;
bool get xcodeVersionSatisfactory {
if (_xcodeVersionSatisfactory != null) {
......
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