aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2018-05-16 06:06:08 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-16 06:07:53 -0700
commitb6eae7754c434c31f87ce84a06e017d603eb6f78 (patch)
treefba42275d9b04829fa79f9e1321e2551e0f13f7e /src/main/java/com/google/devtools/build/lib/analysis
parentba03094560ec597153c1c154591600c9c9d1fb1b (diff)
Filtering the legacy important_outputs field in the BEP by source, middleman
This change makes the field match the semantics of the legacy mechanism that is not open source. This is intended for migration only and the field should not be used otherwise (that is why the field is deprecated). PiperOrigin-RevId: 196817282
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java
index 49e470c9ad..d8b09c99ad 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java
@@ -64,14 +64,14 @@ public final class TargetCompleteEvent
private final ConfiguredTargetAndData targetAndData;
private final NestedSet<Cause> rootCauses;
private final ImmutableList<BuildEventId> postedAfter;
- private final Iterable<ArtifactsInOutputGroup> outputs;
+ private final NestedSet<ArtifactsInOutputGroup> outputs;
private final NestedSet<Artifact> baselineCoverageArtifacts;
private final boolean isTest;
private TargetCompleteEvent(
ConfiguredTargetAndData targetAndData,
NestedSet<Cause> rootCauses,
- Iterable<ArtifactsInOutputGroup> outputs,
+ NestedSet<ArtifactsInOutputGroup> outputs,
boolean isTest) {
this.targetAndData = targetAndData;
this.rootCauses =
@@ -122,7 +122,8 @@ public final class TargetCompleteEvent
public static TargetCompleteEvent createFailed(
ConfiguredTargetAndData ct, NestedSet<Cause> rootCauses) {
Preconditions.checkArgument(!Iterables.isEmpty(rootCauses));
- return new TargetCompleteEvent(ct, rootCauses, ImmutableList.of(), false);
+ return new TargetCompleteEvent(
+ ct, rootCauses, NestedSetBuilder.emptySet(Order.STABLE_ORDER), false);
}
/** Returns the target associated with the event. */
@@ -140,6 +141,19 @@ public final class TargetCompleteEvent
return rootCauses;
}
+ public Iterable<Artifact> getLegacyFilteredImportantArtifacts() {
+ // TODO(ulfjack): This duplicates code in ArtifactsToBuild.
+ NestedSetBuilder<Artifact> builder = new NestedSetBuilder<>(outputs.getOrder());
+ for (ArtifactsInOutputGroup artifactsInOutputGroup : outputs) {
+ if (artifactsInOutputGroup.areImportant()) {
+ builder.addTransitive(artifactsInOutputGroup.getArtifacts());
+ }
+ }
+ return Iterables.filter(
+ builder.build(),
+ (artifact) -> !artifact.isSourceArtifact() && !artifact.isMiddlemanArtifact());
+ }
+
@Override
public BuildEventId getEventId() {
Label label = getTarget().getLabel();
@@ -218,11 +232,7 @@ public final class TargetCompleteEvent
// TODO(aehlig): remove direct reporting of artifacts as soon as clients no longer
// need it.
- for (ArtifactsInOutputGroup group : outputs) {
- if (group.areImportant()) {
- addImportantOutputs(builder, converters, group.getArtifacts());
- }
- }
+ addImportantOutputs(builder, converters, getLegacyFilteredImportantArtifacts());
if (baselineCoverageArtifacts != null) {
addImportantOutputs(
builder, (artifact -> BASELINE_COVERAGE), converters, baselineCoverageArtifacts);