*** Reason for rollback ***
Rollforward with fix for b/365154741
*** Original change description ***
Automated rollback of commit 0bc1ba56ef
.
*** Reason for rollback ***
TAP failures in Bazel/Blaze, see b/365154741 and discussion at https://chat.google.com/room/AAAAXE3XKrY/_e3TpBFJvus
*** Original change description ***
Add user-facing documentation for cc_tool_map
BEGIN_PUBLIC
Add user-facing documentation for cc_tool_map
Adds user-facing documentation for the cc_tool_map toolchain rule, including an example and higher level analogies.
END_PUBLIC
***
***
PiperOrigin-RevId: 672000172
Change-Id: If7ad64e2378a2016d389a3718944aa04bc5e9759
2.8 KiB
This is a list of rules/macros that should be exported as documentation.
cc_tool_map
cc_tool_map(name, tools, kwargs)
A toolchain configuration rule that maps toolchain actions to tools.
A cc_tool_map aggregates all the tools that may be used for a given toolchain and maps them to
their corresponding actions. Conceptually, this is similar to the CXX=/path/to/clang++
environment variables that most build systems use to determine which tools to use for a given
action. To simplify usage, some actions have been grouped together (for example,
//third_party/bazel_rules/rules_cc/cc/toolchains/actions:cpp_compile_actions) to
logically express "all the C++ compile actions".
In Bazel, there is a little more granularity to the mapping, so the mapping doesn't follow the
traditional CXX
, AR
, etc. naming scheme. For a comprehensive list of all the well-known
actions, see //third_party/bazel_rules/rules_cc/cc/toolchains/actions:BUILD.
Example usage:
load("//third_party/bazel_rules/rules_cc/cc/toolchains:tool_map.bzl", "cc_tool_map")
cc_tool_map(
name = "all_tools",
tools = {
"//third_party/bazel_rules/rules_cc/cc/toolchains/actions:assembly_actions": ":asm",
"//third_party/bazel_rules/rules_cc/cc/toolchains/actions:c_compile": ":clang",
"//third_party/bazel_rules/rules_cc/cc/toolchains/actions:cpp_compile_actions": ":clang++",
"//third_party/bazel_rules/rules_cc/cc/toolchains/actions:link_actions": ":lld",
"//third_party/bazel_rules/rules_cc/cc/toolchains/actions:objcopy_embed_data": ":llvm-objcopy",
"//third_party/bazel_rules/rules_cc/cc/toolchains/actions:strip": ":llvm-strip",
"//third_party/bazel_rules/rules_cc/cc/toolchains/actions:ar_actions": ":llvm-ar",
},
)
Note: Due to an implementation limitation, if you need to map the same tool to multiple actions, you will need to create an intermediate alias for the tool for each set of actions. See https://github.com/bazelbuild/rules_cc/issues/235 for more details.
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | (str) The name of the target. | none |
tools | (Dict[target providing ActionTypeSetInfo, Executable target]) A mapping between cc_action_type targets and the cc_tool or executable target that implements that action. |
none |
kwargs | common attributes that should be applied to this rule. | none |