Skip to content

Commit

Permalink
Add explicit version minimums for macOS tools
Browse files Browse the repository at this point in the history
This is a follow up to bazelbuild#9371
which helps maintain cache hits across different macOS versions. By
default when you compile something on macOS with clang the minimum OS
version is set to the current OS version. This means if you have
developers on multiple OS versions they may not get cache hits.
  • Loading branch information
keith committed Sep 18, 2019
1 parent 1d2932a commit 7f11304
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/bootstrap/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ cp $OUTPUT_DIR/libblaze.jar ${ARCHIVE_DIR}
# TODO(b/28965185): Remove when xcode-locator is no longer required in embedded_binaries.
log "Compiling xcode-locator..."
if [[ $PLATFORM == "darwin" ]]; then
run /usr/bin/xcrun --sdk macosx clang -fobjc-arc -framework CoreServices -framework Foundation -o ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator tools/osx/xcode_locator.m
run /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices -framework Foundation -o ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator tools/osx/xcode_locator.m
else
cp tools/osx/xcode_locator_stub.sh ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator
fi
Expand Down
2 changes: 1 addition & 1 deletion src/tools/xcode/realpath/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ genrule(
name = "realpath_genrule",
srcs = ["realpath.c"],
outs = ["realpath"],
cmd = "/usr/bin/xcrun --sdk macosx clang -o $@ $<",
cmd = "/usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -o $@ $<",
output_to_bindir = 1,
visibility = ["//visibility:public"],
)
Expand Down
1 change: 1 addition & 0 deletions tools/cpp/osx_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def configure_osx_toolchain(repository_ctx, overriden_tools):
"--sdk",
"macosx",
"clang",
"-mmacosx-version-min=10.9",
"-std=c++11",
"-lc++",
"-o",
Expand Down
2 changes: 1 addition & 1 deletion tools/osx/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports_files([
])

DARWIN_XCODE_LOCATOR_COMPILE_COMMAND = """
/usr/bin/xcrun --sdk macosx clang -fobjc-arc -framework CoreServices \
/usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices \
-framework Foundation -o $@ $<
"""

Expand Down
1 change: 1 addition & 0 deletions tools/osx/xcode_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def run_xcode_locator(repository_ctx, xcode_locator_src_label):
"--sdk",
"macosx",
"clang",
"-mmacosx-version-min=10.9",
"-fobjc-arc",
"-framework",
"CoreServices",
Expand Down

0 comments on commit 7f11304

Please sign in to comment.