|
14 | 14 |
|
15 | 15 | package com.google.devtools.build.lib.analysis;
|
16 | 16 |
|
17 |
| -import static com.google.common.base.MoreObjects.firstNonNull; |
18 | 17 | import static com.google.common.base.Preconditions.checkNotNull;
|
19 | 18 |
|
20 | 19 | import com.google.common.collect.ImmutableList;
|
21 | 20 | import com.google.common.collect.ImmutableMap;
|
22 | 21 | import com.google.common.collect.ImmutableSet;
|
23 | 22 | import com.google.common.collect.Iterables;
|
24 | 23 | import com.google.devtools.build.lib.actions.Artifact;
|
| 24 | +import com.google.devtools.build.lib.analysis.test.TestProvider; |
25 | 25 | import com.google.devtools.build.lib.collect.nestedset.NestedSet;
|
26 | 26 | import com.google.devtools.build.lib.collect.nestedset.NestedSet.Node;
|
27 | 27 | import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
|
@@ -137,20 +137,24 @@ public static ImmutableSet<Artifact> findAllTopLevelArtifacts(AnalysisResult ana
|
137 | 137 | ImmutableSet.Builder<Artifact> artifacts = ImmutableSet.builder();
|
138 | 138 | artifacts.addAll(analysisResult.getArtifactsToBuild());
|
139 | 139 |
|
140 |
| - Iterable<ProviderCollection> providers = |
141 |
| - Iterables.concat( |
142 |
| - analysisResult.getTargetsToBuild(), |
143 |
| - analysisResult.getAspectsMap().values(), |
144 |
| - firstNonNull(analysisResult.getTargetsToTest(), ImmutableList.of())); |
145 | 140 | TopLevelArtifactContext ctx = analysisResult.getTopLevelContext();
|
146 | 141 | Set<NestedSet.Node> visited = new HashSet<>();
|
147 | 142 |
|
148 |
| - for (ProviderCollection provider : providers) { |
| 143 | + for (ProviderCollection provider : |
| 144 | + Iterables.concat( |
| 145 | + analysisResult.getTargetsToBuild(), analysisResult.getAspectsMap().values())) { |
149 | 146 | for (ArtifactsInOutputGroup group :
|
150 | 147 | getAllArtifactsToBuild(provider, ctx).getAllArtifactsByOutputGroup().values()) {
|
151 | 148 | memoizedAddAll(group.getArtifacts(), artifacts, visited);
|
152 | 149 | }
|
153 | 150 | }
|
| 151 | + |
| 152 | + if (analysisResult.getTargetsToTest() != null) { |
| 153 | + for (ConfiguredTarget testTarget : analysisResult.getTargetsToTest()) { |
| 154 | + artifacts.addAll(TestProvider.getTestStatusArtifacts(testTarget)); |
| 155 | + } |
| 156 | + } |
| 157 | + |
154 | 158 | return artifacts.build();
|
155 | 159 | }
|
156 | 160 | }
|
|
0 commit comments