diff options
author | Chris Parsons <cparsons@google.com> | 2016-10-04 18:39:09 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-10-05 12:25:53 +0000 |
commit | 7479f67eaf56ab99cb0a5f39b93a89df1bd4f028 (patch) | |
tree | eb760989566627b5ea8fd045001b41eede157a4d /tools | |
parent | 162aab530c3f73d3c7df53ee768d0ee586c12d13 (diff) |
Check "xcodebuild -version" first before building the xcode locator.
This prevents a warning on machines which have no xcode versions installed.
--
MOS_MIGRATED_REVID=135131956
Diffstat (limited to 'tools')
-rw-r--r-- | tools/osx/xcode_configure.bzl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/osx/xcode_configure.bzl b/tools/osx/xcode_configure.bzl index 62e0df6dcb..114f7abe93 100644 --- a/tools/osx/xcode_configure.bzl +++ b/tools/osx/xcode_configure.bzl @@ -83,6 +83,13 @@ VERSION_CONFIG_STUB = "xcode_config(name = 'host_xcodes')" def _darwin_build_file(repository_ctx): """Evaluates local system state to create xcode_config and xcode_version targets.""" + xcodebuild_result = repository_ctx.execute(["xcodebuild", "-version"]) + # "xcodebuild -version" failing may be indicative of no versions of xcode + # installed, which is an acceptable machine configuration to have for using + # bazel. Thus no warning should be emitted here. + if (xcodebuild_result.return_code != 0): + return VERSION_CONFIG_STUB + xcodeloc_src_path = str(repository_ctx.path(Label(repository_ctx.attr.xcode_locator))) repository_ctx.execute(["xcrun", "clang", "-fobjc-arc", "-framework", "CoreServices", "-framework", "Foundation", "-o", "xcode-locator-bin", xcodeloc_src_path]) @@ -93,13 +100,6 @@ def _darwin_build_file(repository_ctx): code=xcode_locator_result.return_code, err=xcode_locator_result.stderr)) return VERSION_CONFIG_STUB - xcodebuild_result = repository_ctx.execute(["xcodebuild", "-version"]) - if (xcodebuild_result.return_code != 0): - print( - "Invoking xcodebuild failed, return code {code}, stderr: {err}".format( - code=xcodebuild_result.return_code, - err=xcodebuild_result.stderr)) - return VERSION_CONFIG_STUB default_xcode_version = _search_string(xcodebuild_result.stdout, "Xcode ", "\n") default_xcode_target = "" |