diff options
author | Chris Parsons <cparsons@google.com> | 2016-09-20 15:41:09 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2016-09-21 07:06:36 +0000 |
commit | cc867d4b7a2a42188ba5ef5114dad2c2fab60351 (patch) | |
tree | d233a79b540da41127207411eaf85e0a22cd4188 /tools | |
parent | 8539a1215bb58211c7c643005d2389ecafa6f580 (diff) |
In local_xcode_config rule, when xcode-locator-bin fails (generally due to xcode not being installed), create a stub xcode_version target instead of a malformed one.
--
MOS_MIGRATED_REVID=133709696
Diffstat (limited to 'tools')
-rw-r--r-- | tools/osx/xcode_configure.bzl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/osx/xcode_configure.bzl b/tools/osx/xcode_configure.bzl index 7546bd8e28..62e0df6dcb 100644 --- a/tools/osx/xcode_configure.bzl +++ b/tools/osx/xcode_configure.bzl @@ -78,6 +78,9 @@ def _xcode_version_output(repository_ctx, name, version, aliases, developer_dir) return build_contents +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.""" xcodeloc_src_path = str(repository_ctx.path(Label(repository_ctx.attr.xcode_locator))) @@ -89,12 +92,14 @@ def _darwin_build_file(repository_ctx): "Invoking xcode-locator failed, return code {code}, stderr: {err}".format( 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 = "" @@ -141,7 +146,7 @@ def _impl(repository_ctx): if (os_name.startswith("mac os")): build_contents += _darwin_build_file(repository_ctx) else: - build_contents += "xcode_config(name = 'host_xcodes')" + build_contents += VERSION_CONFIG_STUB repository_ctx.file("BUILD", build_contents) xcode_autoconf = repository_rule( |