Take #2 of add repo mapping to bazel context.
This is so that @SkylarkCallable methods (Label.relative in particular) can have access to the repository mapping from the context to properly convert labels.
Initial submit broke rules_go in downstream: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/725#35b48f7f-3e95-4322-a360-88c6dc7fb748, but unknown commit fixed it.
RELNOTES: None
PiperOrigin-RevId: 228573949
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClassProvider.java
index 302b05b..97b8722 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/RuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClassProvider.java
@@ -14,7 +14,9 @@
package com.google.devtools.build.lib.packages;
+import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.cmdline.Label;
+import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.syntax.Environment;
import com.google.devtools.build.lib.syntax.Environment.Extension;
@@ -44,15 +46,16 @@
Map<String, RuleClass> getRuleClassMap();
/**
- * Returns a new Skylark Environment instance for rule creation.
- * Implementations need to be thread safe.
- * Be sure to close() the mutability before you return the results of said evaluation.
+ * Returns a new Skylark Environment instance for rule creation. Implementations need to be thread
+ * safe. Be sure to close() the mutability before you return the results of said evaluation.
*
* @param label the location of the rule.
* @param mutability the Mutability for the current evaluation context
* @param skylarkSemantics the semantics options that modify the interpreter
* @param eventHandler the EventHandler for warnings, errors, etc.
* @param astFileContentHashCode the hash code identifying this environment.
+ * @param importMap map from import string to Extension
+ * @param repoMapping map of RepositoryNames to be remapped
* @return an Environment, in which to evaluate load time skylark forms.
*/
Environment createSkylarkRuleClassEnvironment(
@@ -61,7 +64,8 @@
SkylarkSemantics skylarkSemantics,
EventHandler eventHandler,
@Nullable String astFileContentHashCode,
- @Nullable Map<String, Extension> importMap);
+ @Nullable Map<String, Extension> importMap,
+ ImmutableMap<RepositoryName, RepositoryName> repoMapping);
/**
* Returns a map from aspect names to aspect factory objects.