diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ResolvedToolchainContext.java b/src/main/java/com/google/devtools/build/lib/analysis/ResolvedToolchainContext.java index 63e30d9e3982fc..9ecc4106d3094f 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/ResolvedToolchainContext.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/ResolvedToolchainContext.java @@ -24,10 +24,8 @@ import com.google.devtools.build.lib.analysis.platform.PlatformProviderUtils; import com.google.devtools.build.lib.analysis.platform.ToolchainInfo; import com.google.devtools.build.lib.analysis.platform.ToolchainTypeInfo; -import com.google.devtools.build.lib.analysis.skylark.BazelStarlarkContext; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.cmdline.LabelSyntaxException; -import com.google.devtools.build.lib.cmdline.RepositoryName; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; import com.google.devtools.build.lib.events.Location; @@ -191,8 +189,7 @@ public void repr(SkylarkPrinter printer) { printer.append(">"); } - private static Label transformKey(Object key, Location loc, StarlarkContext context) - throws EvalException { + private Label transformKey(Object key, Location loc) throws EvalException { if (key instanceof Label) { return (Label) key; } else if (key instanceof ToolchainTypeInfo) { @@ -200,12 +197,8 @@ private static Label transformKey(Object key, Location loc, StarlarkContext cont } else if (key instanceof String) { Label toolchainType; String rawLabel = (String) key; - ImmutableMap repoMapping = ImmutableMap.of(); - if (context instanceof BazelStarlarkContext) { - repoMapping = ((BazelStarlarkContext) context).getRepoMapping(); - } try { - toolchainType = Label.parseAbsolute(rawLabel, repoMapping); + toolchainType = Label.parseAbsolute(rawLabel, ImmutableMap.of()); } catch (LabelSyntaxException e) { throw new EvalException( loc, String.format("Unable to parse toolchain %s: %s", rawLabel, e.getMessage()), e); @@ -223,7 +216,7 @@ private static Label transformKey(Object key, Location loc, StarlarkContext cont @Override public ToolchainInfo getIndex(Object key, Location loc, StarlarkContext context) throws EvalException { - Label toolchainTypeLabel = transformKey(key, loc, context); + Label toolchainTypeLabel = transformKey(key, loc); if (!containsKey(key, loc, context)) { // TODO(bazel-configurability): The list of available toolchain types is confusing in the @@ -246,7 +239,7 @@ public ToolchainInfo getIndex(Object key, Location loc, StarlarkContext context) @Override public boolean containsKey(Object key, Location loc, StarlarkContext context) throws EvalException { - Label toolchainTypeLabel = transformKey(key, loc, context); + Label toolchainTypeLabel = transformKey(key, loc); return requestedToolchainTypeLabels().containsKey(toolchainTypeLabel); } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java index 2e384a73e076e3..2737aa2f4496f1 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java @@ -43,7 +43,6 @@ import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.cmdline.LabelSyntaxException; import com.google.devtools.build.lib.cmdline.LabelValidator; -import com.google.devtools.build.lib.cmdline.RepositoryName; import com.google.devtools.build.lib.events.Location; import com.google.devtools.build.lib.packages.Attribute; import com.google.devtools.build.lib.packages.AttributeMap; @@ -355,14 +354,9 @@ public BaseFunction rule( builder.setConfiguredTargetFunction(implementation); builder.setRuleDefinitionEnvironmentLabelAndHashCode( funcallEnv.getGlobals().getLabel(), funcallEnv.getTransitiveContentHashCode()); - - ImmutableMap repoMapping = ImmutableMap.of(); - if (context instanceof BazelStarlarkContext) { - repoMapping = ((BazelStarlarkContext) context).getRepoMapping(); - } builder.addRequiredToolchains( collectToolchainLabels( - toolchains.getContents(String.class, "toolchains"), ast.getLocation(), repoMapping)); + toolchains.getContents(String.class, "toolchains"), ast.getLocation())); if (!buildSetting.equals(Runtime.NONE) && !cfg.equals(Runtime.NONE)) { throw new EvalException( @@ -403,8 +397,7 @@ public BaseFunction rule( builder.addExecutionPlatformConstraints( collectConstraintLabels( execCompatibleWith.getContents(String.class, "exec_compatile_with"), - ast.getLocation(), - repoMapping)); + ast.getLocation())); } if (executionPlatformConstraintsAllowed) { @@ -455,14 +448,11 @@ private static void addAttribute( } private static ImmutableList