Add toolchains data to RuleClass and RuleContext.
Also expose both sides to Skylark.
Part of #2219.
Change-Id: I4d749dd9981fe33f75310acb0ec3927cff6f28fe
PiperOrigin-RevId: 156340638
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index a6c43d4..f1e1db2 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -167,6 +167,7 @@
private final ErrorReporter reporter;
private final ImmutableBiMap<String, Class<? extends TransitiveInfoProvider>>
skylarkProviderRegistry;
+ private final ToolchainContext toolchainContext;
private ActionOwner actionOwner;
@@ -197,6 +198,8 @@
this.skylarkProviderRegistry = builder.skylarkProviderRegistry;
this.hostConfiguration = builder.hostConfiguration;
reporter = builder.reporter;
+ // TODO(katre): Populate the actual selected toolchains.
+ this.toolchainContext = new ToolchainContext(null);
}
private ImmutableSet<String> getEnabledFeatures() {
@@ -1121,6 +1124,10 @@
}
}
+ public ToolchainContext getToolchainContext() {
+ return toolchainContext;
+ }
+
private void checkAttribute(String attributeName, Mode mode) {
Attribute attributeDefinition = attributes.getAttributeDefinition(attributeName);
if (attributeDefinition == null) {