From 762b5d840760690cafc40ddb65b56a8933350877 Mon Sep 17 00:00:00 2001 From: jcater Date: Thu, 6 May 2021 08:02:18 -0700 Subject: [PATCH] BuildViewForTesting should directly call into ConfiguredTargetFunction. Previously it was trying to replicate the code, but wasn't exact. PiperOrigin-RevId: 372343711 --- .../skyframe/ConfiguredTargetFunction.java | 2 +- .../analysis/util/BuildViewForTesting.java | 52 +++---------------- 2 files changed, 8 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java index 4289ba710b7554..63b7520bd7b655 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java @@ -449,7 +449,7 @@ public SkyValue compute(SkyKey key, Environment env) throws ConfiguredTargetFunc */ @VisibleForTesting @Nullable - static ToolchainCollection computeUnloadedToolchainContexts( + public static ToolchainCollection computeUnloadedToolchainContexts( Environment env, RuleClassProvider ruleClassProvider, TargetAndConfiguration targetAndConfig, diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java index fb87598167fd82..a7593987d185f9 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java @@ -87,7 +87,6 @@ import com.google.devtools.build.lib.events.StoredEventHandler; import com.google.devtools.build.lib.packages.Attribute; import com.google.devtools.build.lib.packages.BuildType; -import com.google.devtools.build.lib.packages.ExecGroup; import com.google.devtools.build.lib.packages.NoSuchPackageException; import com.google.devtools.build.lib.packages.NoSuchTargetException; import com.google.devtools.build.lib.packages.PackageSpecification; @@ -99,6 +98,7 @@ import com.google.devtools.build.lib.skyframe.AspectValueKey.AspectKey; import com.google.devtools.build.lib.skyframe.BuildConfigurationValue; import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData; +import com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction; import com.google.devtools.build.lib.skyframe.ConfiguredTargetKey; import com.google.devtools.build.lib.skyframe.PackageValue; import com.google.devtools.build.lib.skyframe.SkyFunctionEnvironmentForTesting; @@ -107,17 +107,14 @@ import com.google.devtools.build.lib.skyframe.SkyframeExecutorWrappingWalkableGraph; import com.google.devtools.build.lib.skyframe.StarlarkBuiltinsValue; import com.google.devtools.build.lib.skyframe.TargetPatternPhaseValue; -import com.google.devtools.build.lib.skyframe.ToolchainContextKey; import com.google.devtools.build.lib.skyframe.ToolchainException; import com.google.devtools.build.lib.skyframe.UnloadedToolchainContext; import com.google.devtools.build.lib.util.OrderedSetMultimap; import com.google.devtools.build.skyframe.SkyFunction; import com.google.devtools.build.skyframe.SkyKey; -import com.google.devtools.build.skyframe.ValueOrException; import com.google.devtools.build.skyframe.Version; import com.google.devtools.build.skyframe.WalkableGraph; import java.util.Collection; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -621,51 +618,16 @@ public RuleContext getRuleContextForTesting( Event.error("Failed to get target when trying to get rule context for testing")); throw new IllegalStateException(e); } - ImmutableSet