@@ -4,35 +4,30 @@ repository, i.e., the targets defined here appear in the workspace as
44"@arm_none_eabi//:*" for arm-none-eabi toolchains.
55"""
66
7- load("@toolchains_arm_gnu//toolchain:toolchain.bzl", "hosts", "tools")
87load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
8+ load("@local_config_platform//:constraints.bzl", "HOST_CONSTRAINTS")
9+ load(
10+ "@toolchains_arm_gnu//toolchain:toolchain.bzl",
11+ "host_from",
12+ "hosts",
13+ "tools",
14+ )
915
1016package(default_visibility = ["//visibility:public"])
1117
12- TOOLS = tools + ["bin"]
13-
14- [
15- config_setting(
16- name = host,
17- constraint_values = constraint_values,
18- )
19- for host, constraint_values in hosts["%toolchain_prefix%"].items()
20- ]
18+ TOOLS = tools
19+ host = host_from(HOST_CONSTRAINTS)
2120
2221[
2322 native_binary(
2423 name = tool,
25- src = select({
26- host: "@%toolchain_name%_{}//:{}".format(host, tool)
27- for host in hosts["%toolchain_prefix%"].keys()
28- }),
24+ src = "@%toolchain_name%_{}//:{}".format(host, tool),
2925 out = tool,
30- target_compatible_with = select({
31- host: constraint_values
32- for host, constraint_values in hosts["%toolchain_prefix%"].items()
33- } | {
34- "//conditions:default": ["@platforms//:incompatible"],
35- }),
26+ target_compatible_with = (
27+ []
28+ if host in hosts["%toolchain_prefix%"].keys() else
29+ ["@platforms//:incompatible"]
30+ ),
3631 )
3732 for tool in TOOLS
3833]
0 commit comments