diff options
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/BuildView.java | 19 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java | 15 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java index 8beac6213c..606119765b 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java @@ -321,6 +321,7 @@ public class BuildView { private final ImmutableList<AspectValue> aspects; private final PackageRoots packageRoots; private final String workspaceName; + List<TargetAndConfiguration> topLevelTargetsWithConfigs; private AnalysisResult( Collection<ConfiguredTarget> targetsToBuild, @@ -334,7 +335,8 @@ public class BuildView { Collection<ConfiguredTarget> exclusiveTests, TopLevelArtifactContext topLevelContext, PackageRoots packageRoots, - String workspaceName) { + String workspaceName, + List<TargetAndConfiguration> topLevelTargetsWithConfigs) { this.targetsToBuild = ImmutableSet.copyOf(targetsToBuild); this.aspects = ImmutableList.copyOf(aspects); this.targetsToTest = targetsToTest == null ? null : ImmutableList.copyOf(targetsToTest); @@ -347,6 +349,7 @@ public class BuildView { this.topLevelContext = topLevelContext; this.packageRoots = packageRoots; this.workspaceName = workspaceName; + this.topLevelTargetsWithConfigs = topLevelTargetsWithConfigs; } /** @@ -427,8 +430,11 @@ public class BuildView { public String getWorkspaceName() { return workspaceName; } - } + public List<TargetAndConfiguration> getTopLevelTargetsWithConfigs() { + return topLevelTargetsWithConfigs; + } + } /** * Returns the collection of configured targets corresponding to any of the provided targets. @@ -595,7 +601,8 @@ public class BuildView { topLevelOptions, viewOptions, skyframeAnalysisResult, - targetsToSkip); + targetsToSkip, + topLevelTargetsWithConfigs); logger.info("Finished analysis"); return result; } @@ -606,7 +613,8 @@ public class BuildView { TopLevelArtifactContext topLevelOptions, BuildView.Options viewOptions, SkyframeAnalysisResult skyframeAnalysisResult, - Set<ConfiguredTarget> targetsToSkip) + Set<ConfiguredTarget> targetsToSkip, + List<TargetAndConfiguration> topLevelTargetsWithConfigs) throws InterruptedException { Collection<Target> testsToRun = loadingResult.getTestsToRun(); Set<ConfiguredTarget> configuredTargets = @@ -690,7 +698,8 @@ public class BuildView { exclusiveTests, topLevelOptions, skyframeAnalysisResult.getPackageRoots(), - loadingResult.getWorkspaceName()); + loadingResult.getWorkspaceName(), + topLevelTargetsWithConfigs); } @Nullable diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java b/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java index 42f53d6e9a..4a7165058a 100644 --- a/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java +++ b/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java @@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.actions.BuildFailedException; import com.google.devtools.build.lib.actions.TestExecException; import com.google.devtools.build.lib.analysis.AnalysisPhaseCompleteEvent; -import com.google.devtools.build.lib.analysis.AnalysisUtils; import com.google.devtools.build.lib.analysis.BuildInfoEvent; import com.google.devtools.build.lib.analysis.BuildView; import com.google.devtools.build.lib.analysis.BuildView.AnalysisResult; @@ -244,7 +243,8 @@ public final class BuildTool { "Configured query is not allowed if incrementality state is not being kept"); } try { - doConfiguredTargetQuery(request, configurations, loadingResult); + doConfiguredTargetQuery( + request, configurations, analysisResult.getTopLevelTargetsWithConfigs()); } catch (QueryException | IOException e) { if (!request.getKeepGoing()) { throw new ViewCreationFailedException("Error doing configured target query", e); @@ -412,18 +412,9 @@ public final class BuildTool { private void doConfiguredTargetQuery( BuildRequest request, BuildConfigurationCollection configurations, - LoadingResult loadingResult) + List<TargetAndConfiguration> topLevelTargetsWithConfigs) throws InterruptedException, QueryException, IOException { - // Determine the configurations. - List<TargetAndConfiguration> topLevelTargetsWithConfigs = - AnalysisUtils.getTargetsWithConfigs( - configurations, - loadingResult.getTargets(), - env.getReporter(), - runtime.getRuleClassProvider(), - env.getSkyframeExecutor()); - String queryExpr = request.getBuildOptions().queryExpression; // Currently, CTQE assumes that all top level targets take on the same default config and we |