Skip to content

Commit

Permalink
Use configuration flags for //src/conditions:darwin_arm64
Browse files Browse the repository at this point in the history
Partially reverts 6d637f4, to allow
cross-compiling Bazel from darwin_x86_64 to darwin_arm64 with
the `--cpu=darwin_arm64` flag.

The only source that is different between darwin_x86_64 and darwin_arm64
now is the embedded JDK.

Closes bazelbuild#12653.

PiperOrigin-RevId: 346298051
  • Loading branch information
thii authored and copybara-github committed Dec 8, 2020
1 parent 364b77e commit 52457b1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/conditions/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@bazel_skylib//lib:selects.bzl", "selects")

filegroup(
name = "srcs",
srcs = glob(["**"]),
Expand Down Expand Up @@ -89,11 +91,28 @@ config_setting(
)

config_setting(
name = "darwin_arm64",
name = "darwin_arm64_constraint",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:arm64",
],
)

config_setting(
name = "darwin_arm64_flag",
values = {"cpu": "darwin_arm64"},
)

# Workaround for an issue where the dummy cc toolchain isn't being picked up
# when cross-compile from darwin_x86_64 to darwin_arm64 cpu.
# TODO(https://github.com/bazelbuild/bazel/issues/12655): Remove the flag based
# select when the issue is resolved.
selects.config_setting_group(
name = "darwin_arm64",
match_any = [
":darwin_arm64_constraint",
":darwin_arm64_flag",
],
visibility = ["//visibility:public"],
)

Expand Down

0 comments on commit 52457b1

Please sign in to comment.