diff options
author | John Cater <jcater@google.com> | 2018-07-09 15:02:42 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-09 15:04:27 -0700 |
commit | ae4e78523a28437aad15c61635eb37ec516878cf (patch) | |
tree | 3a60489d91d953016505ca168189cc30bd46a9e4 /src/test/java | |
parent | 0e32b31b8ff94ece1f7987ee3e5a5532c6c45212 (diff) |
Pull up calls to ToolchainContext.resolvedToolchainLabels and finish
ToolchainContext configuration earlier.
Change-Id: I034f56a8a181aac19ecb38e51558ccdc6c0c7a6a
PiperOrigin-RevId: 203835978
Diffstat (limited to 'src/test/java')
3 files changed, 28 insertions, 11 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java index 25e0c83f65..471c742ba6 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.fail; import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -376,8 +377,14 @@ public class BuildViewTest extends BuildViewTestBase { "filegroup(name='top', srcs=[':inner', 'file'])", "sh_binary(name='inner', srcs=['script.sh'])"); ConfiguredTarget top = Iterables.getOnlyElement(update("//package:top").getTargetsToBuild()); - Iterable<Dependency> targets = getView().getDirectPrerequisiteDependenciesForTesting( - reporter, top, getBuildConfigurationCollection(), /*toolchainContext=*/ null).values(); + Iterable<Dependency> targets = + getView() + .getDirectPrerequisiteDependenciesForTesting( + reporter, + top, + getBuildConfigurationCollection(), + /*toolchainLabels=*/ ImmutableSet.of()) + .values(); Dependency innerDependency = Dependency.withTransitionAndAspects( 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 14a3cc5386..7ab4d65212 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 @@ -262,7 +262,7 @@ public class BuildViewForTesting { configuration, ImmutableSet.copyOf( getDirectPrerequisiteDependenciesForTesting( - eventHandler, ct, configurations, /*toolchainContext=*/ null) + eventHandler, ct, configurations, /*toolchainLabels=*/ ImmutableSet.of()) .values())); } @@ -271,7 +271,7 @@ public class BuildViewForTesting { final ExtendedEventHandler eventHandler, final ConfiguredTarget ct, BuildConfigurationCollection configurations, - ToolchainContext toolchainContext) + ImmutableSet<Label> toolchainLabels) throws EvalException, InvalidConfigurationException, InterruptedException, InconsistentAspectOrderException { @@ -352,7 +352,7 @@ public class BuildViewForTesting { configurations.getHostConfiguration(), /*aspect=*/ null, getConfigurableAttributeKeysForTesting(eventHandler, ctgNode), - toolchainContext == null ? ImmutableSet.of() : toolchainContext.resolvedToolchainLabels(), + toolchainLabels, skyframeExecutor.getDefaultBuildOptions(), ruleClassProvider.getTrimmingTransitionFactory()); } @@ -386,12 +386,12 @@ public class BuildViewForTesting { final ExtendedEventHandler eventHandler, ConfiguredTarget target, BuildConfigurationCollection configurations, - ToolchainContext toolchainContext) + ImmutableSet<Label> toolchainLabels) throws EvalException, InvalidConfigurationException, InterruptedException, InconsistentAspectOrderException { OrderedSetMultimap<Attribute, Dependency> depNodeNames = getDirectPrerequisiteDependenciesForTesting( - eventHandler, target, configurations, toolchainContext); + eventHandler, target, configurations, toolchainLabels); ImmutableMultimap<Dependency, ConfiguredTargetAndData> cts = skyframeExecutor.getConfiguredTargetMapForTesting( @@ -495,7 +495,10 @@ public class BuildViewForTesting { requiredToolchains, targetConfig, eventHandler); OrderedSetMultimap<Attribute, ConfiguredTargetAndData> prerequisiteMap = getPrerequisiteMapForTesting( - eventHandler, configuredTarget, configurations, toolchainContext); + eventHandler, + configuredTarget, + configurations, + toolchainContext.resolvedToolchainLabels()); toolchainContext.resolveToolchains(prerequisiteMap); return new RuleContext.Builder( @@ -512,7 +515,10 @@ public class BuildViewForTesting { PackageGroupContents.create(ImmutableList.of(PackageSpecification.everything())))) .setPrerequisites( getPrerequisiteMapForTesting( - eventHandler, configuredTarget, configurations, toolchainContext)) + eventHandler, + configuredTarget, + configurations, + toolchainContext.resolvedToolchainLabels())) .setConfigConditions(ImmutableMap.<Label, ConfigMatchingProvider>of()) .setUniversalFragments(ruleClassProvider.getUniversalFragments()) .setToolchainContext(toolchainContext) @@ -534,7 +540,10 @@ public class BuildViewForTesting { InconsistentAspectOrderException { Collection<ConfiguredTargetAndData> configuredTargets = getPrerequisiteMapForTesting( - eventHandler, dependentTarget, configurations, /*toolchainContext=*/ null) + eventHandler, + dependentTarget, + configurations, + /*toolchainLabels=*/ ImmutableSet.of()) .values(); for (ConfiguredTargetAndData ct : configuredTargets) { if (ct.getTarget().getLabel().equals(desiredTarget)) { diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java index 79fdc5f56e..31091267d3 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java @@ -24,6 +24,7 @@ import com.google.common.collect.Collections2; import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.ListMultimap; import com.google.common.collect.Multimap; @@ -145,7 +146,7 @@ public class ConfigurationsForTargetsTest extends AnalysisTestCase { (TargetAndConfiguration) skyKey.argument(), ImmutableList.<Aspect>of(), ImmutableMap.<Label, ConfigMatchingProvider>of(), - /*toolchainContext=*/ null, + /*toolchainLabels=*/ ImmutableSet.of(), stateProvider.lateBoundRuleClassProvider(), stateProvider.lateBoundHostConfig(), NestedSetBuilder.<Package>stableOrder(), |