-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Labels
P1I'll work on this now. (Assignee required)I'll work on this now. (Assignee required)team-Rules-CPPIssues for C++ rulesIssues for C++ rulestype: feature request
Description
Currently, rules that require the CC toolchain via toolchain resolution use this syntax:
foo = rule(
...
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
)
(Possibly with other toolchain types present)
With optional toolchains, the syntax is changing, and will wait on a Bazel release.
We should provide a simple helper function that rules can use to be forward compatible when the new optional toolchains are release:
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "use_cpp_toolchain")
foo = rule(
...
toolchains = [other toolchains] + use_cpp_toolchain(mandatory = True),
)
The implemenation of use_cpp_toolchain will update with Bazel and will either return the bare-string toolchain type (as used currently) or the more complicated config.toolchain_type call. Rules won't need to make changes (beyond changing the value of mandatory if desired).
The only parameter will be mandatory, which will default to True for backwards compatibility.
Metadata
Metadata
Assignees
Labels
P1I'll work on this now. (Assignee required)I'll work on this now. (Assignee required)team-Rules-CPPIssues for C++ rulesIssues for C++ rulestype: feature request