Merge branch 'master' into fix_cc_configure
diff --git a/WORKSPACE b/WORKSPACE
index 87a57de..709fbe7 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -54,3 +54,6 @@
rules_proto_dependencies()
rules_proto_toolchains()
+
+load("//cc:repositories.bzl", "rules_cc_toolchains")
+rules_cc_toolchains()
diff --git a/cc/private/toolchain/osx_cc_configure.bzl b/cc/private/toolchain/osx_cc_configure.bzl
index db41831..2412a74 100644
--- a/cc/private/toolchain/osx_cc_configure.bzl
+++ b/cc/private/toolchain/osx_cc_configure.bzl
@@ -24,7 +24,6 @@
load(
":unix_cc_configure.bzl",
"configure_unix_toolchain",
- "find_cc",
"get_env",
"get_escaped_cxx_inc_directories",
)
@@ -64,7 +63,6 @@
"@bazel_tools//tools/objc:xcrunwrapper.sh",
"@bazel_tools//tools/osx/crosstool:BUILD.tpl",
"@bazel_tools//tools/osx/crosstool:cc_toolchain_config.bzl",
- "@bazel_tools//tools/osx/crosstool:wrapped_ar.tpl",
"@bazel_tools//tools/osx/crosstool:wrapped_clang.cc",
"@bazel_tools//tools/osx:xcode_locator.m",
])
@@ -82,7 +80,13 @@
fail("BAZEL_USE_XCODE_TOOLCHAIN is set to 1 but Bazel couldn't find Xcode installed on the " +
"system. Verify that 'xcode-select -p' is correct.")
if xcode_toolchains:
- cc = find_cc(repository_ctx, overriden_tools = {})
+ # For Xcode toolchains, there's no reason to use anything other than
+ # wrapped_clang, so that we still get the Bazel Xcode placeholder
+ # substitution and other behavior for actions that invoke this
+ # cc_wrapper.sh script. The wrapped_clang binary is already hardcoded
+ # into the Objective-C crosstool actions, anyway, so this ensures that
+ # the C++ actions behave consistently.
+ cc = repository_ctx.path("wrapped_clang")
repository_ctx.template(
"cc_wrapper.sh",
paths["@rules_cc//cc/private/toolchain:osx_cc_wrapper.sh.tpl"],
@@ -104,10 +108,6 @@
"make_hashed_objlist.py",
)
repository_ctx.symlink(
- paths["@bazel_tools//tools/osx/crosstool:wrapped_ar.tpl"],
- "wrapped_ar",
- )
- repository_ctx.symlink(
paths["@bazel_tools//tools/osx/crosstool:cc_toolchain_config.bzl"],
"cc_toolchain_config.bzl",
)
@@ -118,7 +118,10 @@
"env",
"-i",
"xcrun",
+ "--sdk",
+ "macosx",
"clang",
+ "-mmacosx-version-min=10.9",
"-std=c++11",
"-lc++",
"-o",
diff --git a/cc/private/toolchain/unix_cc_configure.bzl b/cc/private/toolchain/unix_cc_configure.bzl
index 856486e..707104e 100644
--- a/cc/private/toolchain/unix_cc_configure.bzl
+++ b/cc/private/toolchain/unix_cc_configure.bzl
@@ -252,7 +252,7 @@
)
return opt
-def _get_env(repository_ctx):
+def get_env(repository_ctx):
"""Convert the environment in a list of export if in Homebrew. Doesn't %-escape the result!
Args:
diff --git a/cc/repositories.bzl b/cc/repositories.bzl
index bb41c86..4e1dd8f 100644
--- a/cc/repositories.bzl
+++ b/cc/repositories.bzl
@@ -9,6 +9,7 @@
# Ideally we'd delete this entire file.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+load("//cc/private/toolchain:cc_configure.bzl", "cc_configure")
def rules_cc_dependencies():
_maybe(
@@ -22,6 +23,9 @@
],
)
+def rules_cc_toolchains(*args):
+ cc_configure(*args)
+
def _maybe(repo_rule, name, **kwargs):
if not native.existing_rule(name):
repo_rule(name = name, **kwargs)