Skip to content

Commit a8421af

Browse files
authored
fix: let 'toolchain' attr be selectable (#1321)
1 parent 7a01a7a commit a8421af

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

foreign_cc/private/transitions.bzl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
load("//foreign_cc:providers.bzl", "ForeignCcDepsInfo")
44

55
def _extra_toolchains_transition_impl(settings, attrs):
6-
return {"//command_line_option:extra_toolchains": attrs.extra_toolchains + settings["//command_line_option:extra_toolchains"]}
6+
return {"//command_line_option:extra_toolchains": [attrs.extra_toolchain] + settings["//command_line_option:extra_toolchains"]}
77

88
_extra_toolchains_transition = transition(
99
implementation = _extra_toolchains_transition_impl,
@@ -21,12 +21,13 @@ def _extra_toolchains_transitioned_foreign_cc_target_impl(ctx):
2121
]
2222

2323
extra_toolchains_transitioned_foreign_cc_target = rule(
24-
doc = "A rule for adding extra toolchains to consider when building the given target",
24+
doc = "A rule for adding an extra toolchain to consider when building the given target",
2525
implementation = _extra_toolchains_transitioned_foreign_cc_target_impl,
2626
cfg = _extra_toolchains_transition,
2727
attrs = {
28-
"extra_toolchains": attr.string_list(
29-
doc = "Additional toolchains to consider",
28+
# This attr is singular to make it selectable when used for add make toolchain variant.
29+
"extra_toolchain": attr.string(
30+
doc = "Additional toolchain to consider. Note, this is singular.",
3031
mandatory = True,
3132
),
3233
"target": attr.label(
@@ -64,7 +65,7 @@ def foreign_cc_rule_variant(name, rule, toolchain, **kwargs):
6465

6566
extra_toolchains_transitioned_foreign_cc_target(
6667
name = name,
67-
extra_toolchains = [toolchain],
68+
extra_toolchain = toolchain,
6869
target = foreign_cc_rule_target_name,
6970
tags = tags,
7071
visibility = visibility,

0 commit comments

Comments
 (0)