diff options
author | jcater <jcater@google.com> | 2018-06-21 12:19:48 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-21 12:21:00 -0700 |
commit | 1a025f53f85c70323a3657b692ed9394f6efe721 (patch) | |
tree | 7d0e99d446a78f5b58f3f3ef2b9e7df805f7de10 /src | |
parent | 474d4a1bd59a1c41d6c23b1ee7fce08df903afc7 (diff) |
Rename the implicit attribute used to store toolchain dependencies.
PiperOrigin-RevId: 201565941
Diffstat (limited to 'src')
4 files changed, 15 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java b/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java index 9ad8ba8a16..0ae17e2093 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java @@ -235,7 +235,7 @@ public abstract class DependencyResolver { resolveLateBoundAttributes(depResolver, ruleConfig, hostConfig, defaultBuildOptions); Attribute toolchainsAttribute = - attributeMap.getAttributeDefinition(PlatformSemantics.TOOLCHAINS_ATTR); + attributeMap.getAttributeDefinition(PlatformSemantics.RESOLVED_TOOLCHAINS_ATTR); resolveToolchainDependencies(outgoingEdges.get(toolchainsAttribute), toolchainLabels); } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java b/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java index 65c1047187..facedb708a 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/PlatformSemantics.java @@ -23,14 +23,13 @@ import com.google.devtools.build.lib.packages.RuleClass; /** Helper class to manage rules' use of platforms. */ public class PlatformSemantics { - public static final String TOOLCHAINS_ATTR = "$toolchains"; + public static final String RESOLVED_TOOLCHAINS_ATTR = "$resolved_toolchains_internal"; public static final String EXEC_COMPATIBLE_WITH_ATTR = "exec_compatible_with"; public static RuleClass.Builder platformAttributes(RuleClass.Builder builder) { - return builder - .add( - attr(TOOLCHAINS_ATTR, LABEL_LIST) - .nonconfigurable("Used in toolchain resolution") - .value(ImmutableList.of())); + return builder.add( + attr(RESOLVED_TOOLCHAINS_ATTR, LABEL_LIST) + .nonconfigurable("Used in toolchain resolution") + .value(ImmutableList.of())); } } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java b/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java index d73bc22245..a23dccdad5 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java @@ -159,13 +159,14 @@ public class ToolchainContext implements ToolchainContextApi { private static ImmutableMap<Label, ToolchainInfo> findToolchains( ResolvedToolchainLabels resolvedToolchainLabels, OrderedSetMultimap<Attribute, ConfiguredTargetAndData> prerequisiteMap) { - // Find the prerequisites associated with the $toolchains attribute. + // Find the prerequisites associated with PlatformSemantics.RESOLVED_TOOLCHAINS_ATTR. Optional<Attribute> toolchainAttribute = prerequisiteMap .keys() .stream() .filter(attribute -> attribute != null) - .filter(attribute -> attribute.getName().equals(PlatformSemantics.TOOLCHAINS_ATTR)) + .filter( + attribute -> attribute.getName().equals(PlatformSemantics.RESOLVED_TOOLCHAINS_ATTR)) .findFirst(); Preconditions.checkState( toolchainAttribute.isPresent(), diff --git a/src/main/java/com/google/devtools/build/lib/query2/TransitionsOutputFormatterCallback.java b/src/main/java/com/google/devtools/build/lib/query2/TransitionsOutputFormatterCallback.java index a84386b36a..27685267e8 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/TransitionsOutputFormatterCallback.java +++ b/src/main/java/com/google/devtools/build/lib/query2/TransitionsOutputFormatterCallback.java @@ -127,10 +127,11 @@ public class TransitionsOutputFormatterCallback extends CqueryThreadsafeCallback ((RuleConfiguredTarget) configuredTarget).getConfigConditions(); BuildOptions fromOptions = config.getOptions(); try { - // Note: Being able to pull the $toolchain attr unconditionally from the mapper relies on - // the fact that {@link PlatformSemantics.TOOLCHAIN_ATTRS} exists in every rule. - // Also, we don't actually use fromOptions in our implementation of DependencyResolver but - // passing to avoid passing a null and since we have the information anyway. + // Note: Being able to pull the $resolved_toolchain_internal attr unconditionally from the + // mapper relies on the fact that {@link PlatformSemantics.RESOLVED_TOOLCHAINS_ATTR} exists + // in every rule. Also, we don't actually use fromOptions in our implementation of + // DependencyResolver but passing to avoid passing a null and since we have the information + // anyway. deps = new FormatterDependencyResolver(configuredTarget, reporter) .dependentNodeMap( @@ -140,7 +141,7 @@ public class TransitionsOutputFormatterCallback extends CqueryThreadsafeCallback configConditions, ImmutableSet.copyOf( ConfiguredAttributeMapper.of(target.getAssociatedRule(), configConditions) - .get(PlatformSemantics.TOOLCHAINS_ATTR, BuildType.LABEL_LIST)), + .get(PlatformSemantics.RESOLVED_TOOLCHAINS_ATTR, BuildType.LABEL_LIST)), fromOptions, trimmingTransitionFactory); } catch (EvalException | InvalidConfigurationException | InconsistentAspectOrderException e) { |