Commit 91e6b21e authored by Adam Barth's avatar Adam Barth

Improve error messages for iOS workflow

We now check that you've got an "ios" directory and that you have the proper
version of Xcode.
parent dc74fe3d
......@@ -509,7 +509,35 @@ class _IOSSimulatorInfo {
_IOSSimulatorInfo(this.id, this.name);
}
final RegExp _xcodeVersionRegExp = new RegExp(r'Xcode (\d+)\..*');
final String _xcodeRequirement = 'Xcode 7.0 or greater is required to develop for iOS.';
bool _checkXcodeVersion() {
if (!Platform.isMacOS)
return false;
try {
String version = runCheckedSync(['xcodebuild', '-version']);
Match match = _xcodeVersionRegExp.firstMatch(version);
if (int.parse(match[1]) < 7) {
logging.severe('Found "${match[0]}". $_xcodeRequirement');
return false;
}
} catch (e) {
logging.severe('Cannot find "xcodebuid". $_xcodeRequirement');
return false;
}
return true;
}
Future<bool> _buildIOSXcodeProject(ApplicationPackage app, bool isDevice) async {
if (!FileSystemEntity.isDirectorySync(app.localPath)) {
logging.severe('Path "${path.absolute(app.localPath)}" does not exist.\nDid you run `flutter ios --init`?');
return false;
}
if (!_checkXcodeVersion())
return false;
List<String> command = [
'/usr/bin/env', 'xcrun', 'xcodebuild', '-target', 'Runner', '-configuration', 'Release'
];
......
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