bazel: Use MacOS SDK when building
This sets things up appropriately on Macs but is a no-op on Linux and
Windows.
Bug: b/294443771
Change-Id: I333078a0a763de22ec09685e2ffc6e7774d5e7a3
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/163493
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
diff --git a/recipe_modules/bazel/__init__.py b/recipe_modules/bazel/__init__.py
index 5e8b3d3..d1eed1a 100644
--- a/recipe_modules/bazel/__init__.py
+++ b/recipe_modules/bazel/__init__.py
@@ -15,6 +15,7 @@
# pylint: disable=missing-docstring
DEPS = [
+ 'fuchsia/macos_sdk',
'recipe_engine/cipd',
'recipe_engine/context',
'recipe_engine/file',
diff --git a/recipe_modules/bazel/api.py b/recipe_modules/bazel/api.py
index 83b7cba..d73dd22 100644
--- a/recipe_modules/bazel/api.py
+++ b/recipe_modules/bazel/api.py
@@ -56,9 +56,10 @@
def run(self, **kwargs):
name = ' '.join(['bazel'] + list(self.options.args))
with self.api.context(cwd=self.checkout_root):
- return self.api.step(
- name, [self.ensure(), *self.options.args], **kwargs
- )
+ with self.api.macos_sdk():
+ return self.api.step(
+ name, [self.ensure(), *self.options.args], **kwargs
+ )
# This is copied from bazel.json in Pigweed, but there's no need to keep it