Update documentation for common "toolchains" attribute to clarify that it does not influence toolchain resolution in any way.
PiperOrigin-RevId: 298386757
diff --git a/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/toolchains.html b/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/toolchains.html
index 1c7248b..450ab27 100644
--- a/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/toolchains.html
+++ b/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/toolchains.html
@@ -1,17 +1,20 @@
<p><code>List of <a href="../build-ref.html#labels">labels</a>; optional</code></p>
<p>
-The set of
-<a href="../toolchains.html">toolchains</a>
-this rule has access to.
-</p>
-
-</p>Targets listed here are the set of toolchains whose <a href="${link make-variables}">Make
-variables</a> the rule is allowed to access.</a> These rules are either rules that provide
-the <code>TemplateVariableInfo</code> provider or special targets for toolchain types built into
-Bazel. These include:
+ The set of targets whose <a href="${link make-variables}">Make variables</a> the rule is allowed
+ to access. These rules are either rules that provide
+ the <code>TemplateVariableInfo</code> provider or special targets for toolchain types built into
+Bazel.
+These include:
<ul>
<li><code>@bazel_tools//tools/cpp:current_cc_toolchain</code>
<li><code>@bazel_tools//tools/cpp:current_java_runtime</code>
</ul>
+
+<p>
+ Note that this is distinct from the concept of
+ <a href="../toolchains.html">toolchain resolution</a>
+ that is used by rule implementations for platform-dependenct configuration. You cannot use this
+ attribute to determine which specific cc_toolchain or java_toolchain a target will use.
+</p>
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
index 53ce39a..b7ffed1 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
@@ -405,15 +405,13 @@
@Override
public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
return builder
- /* <!-- #BLAZE_RULE($make_variable_expanding_rule).ATTRIBUTE(toolchains) -->
- The set of toolchains that supply <a href="${link make-variables}">"Make variables"</a>
- that this target can use in some of its attributes. Some rules have toolchains whose Make
- variables they can use by default.
- <!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("toolchains", LABEL_LIST)
- .allowedFileTypes(FileTypeSet.NO_FILE)
- .mandatoryProviders(ImmutableList.of(TemplateVariableInfo.PROVIDER.id()))
- .dontCheckConstraints())
+ // Documented in
+ // com/google/devtools/build/docgen/templates/attributes/common/toolchains.html.
+ .add(
+ attr("toolchains", LABEL_LIST)
+ .allowedFileTypes(FileTypeSet.NO_FILE)
+ .mandatoryProviders(ImmutableList.of(TemplateVariableInfo.PROVIDER.id()))
+ .dontCheckConstraints())
.build();
}