Replace `ProgressLike` marker interface with a boolean method `storeForReplay`.
Makes `Postable` instances not stored by default. In the common case, a post represents some sort of progress event, and storing it in skyframe is a waste of memory.
All existing `Postable`-but-not-`ProgressLike` classes which are posted from a `SkyFunction` (as detected by running presubmit tests) are made to return true from `storeForReplay`. It is possible that some of these were unintentionally stored via the default behavior, but I will audit those in a followup.
PiperOrigin-RevId: 457983032
Change-Id: I6c69b3907c20e3dac362f0c6a9610af17fc4d35d
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionCompletionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionCompletionEvent.java
index 3850f22..f0c4c78 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionCompletionEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionCompletionEvent.java
@@ -14,12 +14,10 @@
package com.google.devtools.build.lib.actions;
import com.google.common.base.MoreObjects;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
-/**
- * An event that is fired after an action completes (either successfully or not).
- */
-public final class ActionCompletionEvent implements ProgressLike {
+/** An event that is fired after an action completes (either successfully or not). */
+public final class ActionCompletionEvent implements Postable {
private final long relativeActionStartTime;
private final Action action;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java
index 6510d17..1018ef8 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java
@@ -29,7 +29,6 @@
import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent;
import com.google.devtools.build.lib.buildeventstream.NullConfiguration;
import com.google.devtools.build.lib.buildeventstream.PathConverter;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
import com.google.devtools.build.lib.server.FailureDetails;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -40,7 +39,7 @@
* This event is fired during the build, when an action is executed. It contains information about
* the action: the Action itself, and the output file names its stdout and stderr are recorded in.
*/
-public class ActionExecutedEvent implements BuildEventWithConfiguration, ProgressLike {
+public final class ActionExecutedEvent implements BuildEventWithConfiguration {
private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();
private final PathFragment actionId;
@@ -130,7 +129,7 @@
@Override
public Collection<BuildEventId> getChildrenEvents() {
- return ImmutableList.<BuildEventId>of();
+ return ImmutableList.of();
}
@Override
@@ -142,7 +141,7 @@
}
return ImmutableList.of(configuration);
} else {
- return ImmutableList.<BuildEvent>of();
+ return ImmutableList.of();
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionMiddlemanEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionMiddlemanEvent.java
index 6468827..a27d0c6 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionMiddlemanEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionMiddlemanEvent.java
@@ -14,14 +14,14 @@
package com.google.devtools.build.lib.actions;
import com.google.common.base.Preconditions;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/**
* This event is fired during the build, when a middleman action is executed. Middleman actions
* don't usually do any computation but we need them in the critical path because they depend on
* other actions.
*/
-public class ActionMiddlemanEvent implements ProgressLike {
+public final class ActionMiddlemanEvent implements Postable {
private final Action action;
private final long nanoTimeStart;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionProgressEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionProgressEvent.java
index 72e4502..3f27d71 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionProgressEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionProgressEvent.java
@@ -14,11 +14,11 @@
package com.google.devtools.build.lib.actions;
import com.google.auto.value.AutoValue;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/** Notifications for the progress of an in-flight action. */
@AutoValue
-public abstract class ActionProgressEvent implements ProgressLike {
+public abstract class ActionProgressEvent implements Postable {
public static ActionProgressEvent create(
ActionExecutionMetadata action, String progressId, String progress, boolean finished) {
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionResultReceivedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionResultReceivedEvent.java
index cb702c1..96666e5 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionResultReceivedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionResultReceivedEvent.java
@@ -14,13 +14,13 @@
package com.google.devtools.build.lib.actions;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/**
* An event that is fired when a non-empty {@link ActionResult} is returned by the execution of an
* {@link Action}.
*/
-public final class ActionResultReceivedEvent implements ProgressLike {
+public final class ActionResultReceivedEvent implements Postable {
private final Action action;
private final ActionResult actionResult;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionScanningCompletedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionScanningCompletedEvent.java
index 33b793e..a8b5db2 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionScanningCompletedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionScanningCompletedEvent.java
@@ -14,13 +14,13 @@
package com.google.devtools.build.lib.actions;
import com.google.common.base.MoreObjects;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/**
* An event that is fired when a input-discovering secondary shared action completes. Such actions
* are not actually executed, so there is no corresponding {@link ActionCompletionEvent}.
*/
-public final class ActionScanningCompletedEvent implements ProgressLike {
+public final class ActionScanningCompletedEvent implements Postable {
private final Action action;
private final ActionLookupData actionLookupData;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionStartedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionStartedEvent.java
index 189f36a..c1b12ff 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionStartedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionStartedEvent.java
@@ -13,12 +13,10 @@
// limitations under the License.
package com.google.devtools.build.lib.actions;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
-/**
- * This event is fired during the build, when an action is started.
- */
-public class ActionStartedEvent implements ProgressLike {
+/** This event is fired during the build, when an action is started. */
+public final class ActionStartedEvent implements Postable {
private final Action action;
private final long nanoTimeStart;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionUploadFinishedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionUploadFinishedEvent.java
index 7d602cc..5bbd4a1 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionUploadFinishedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionUploadFinishedEvent.java
@@ -14,11 +14,11 @@
package com.google.devtools.build.lib.actions;
import com.google.auto.value.AutoValue;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/** The event that is fired when the file being uploaded by the action is finished. */
@AutoValue
-public abstract class ActionUploadFinishedEvent implements ProgressLike {
+public abstract class ActionUploadFinishedEvent implements Postable {
public static ActionUploadFinishedEvent create(
ActionExecutionMetadata action, String resourceId) {
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionUploadStartedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionUploadStartedEvent.java
index ac34a24..415e45d 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionUploadStartedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionUploadStartedEvent.java
@@ -14,11 +14,11 @@
package com.google.devtools.build.lib.actions;
import com.google.auto.value.AutoValue;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/** The event that is fired when the action is about to upload a file. */
@AutoValue
-public abstract class ActionUploadStartedEvent implements ProgressLike {
+public abstract class ActionUploadStartedEvent implements Postable {
public static ActionUploadStartedEvent create(ActionExecutionMetadata action, String resourceId) {
return new AutoValue_ActionUploadStartedEvent(action, resourceId);
}
diff --git a/src/main/java/com/google/devtools/build/lib/actions/CachedActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/CachedActionEvent.java
index 240f5bf..28318e0 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/CachedActionEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/CachedActionEvent.java
@@ -14,12 +14,10 @@
package com.google.devtools.build.lib.actions;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
-/**
- * This event is fired during the build if an action was in the action cache.
- */
-public class CachedActionEvent implements ProgressLike {
+/** This event is fired during the build if an action was in the action cache. */
+public final class CachedActionEvent implements Postable {
private final Action action;
private final long nanoTimeStart;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/CachingActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/CachingActionEvent.java
index 343b463..1aadc64 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/CachingActionEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/CachingActionEvent.java
@@ -16,11 +16,11 @@
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.auto.value.AutoValue;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/** Notifies that an in-flight action is checking the cache. */
@AutoValue
-public abstract class CachingActionEvent implements ProgressLike {
+public abstract class CachingActionEvent implements Postable {
public static CachingActionEvent create(ActionExecutionMetadata action, String strategy) {
return new AutoValue_CachingActionEvent(
diff --git a/src/main/java/com/google/devtools/build/lib/actions/DiscoveredInputsEvent.java b/src/main/java/com/google/devtools/build/lib/actions/DiscoveredInputsEvent.java
index fd1a36b..7900b1d 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/DiscoveredInputsEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/DiscoveredInputsEvent.java
@@ -17,7 +17,7 @@
import com.google.devtools.build.lib.events.ExtendedEventHandler;
/** Event for passing SpawnMetrics for the discover inputs phase. */
-public class DiscoveredInputsEvent implements ExtendedEventHandler.ProgressLike {
+public final class DiscoveredInputsEvent implements ExtendedEventHandler.Postable {
private final SpawnMetrics metrics;
private final Action action;
private final long startTimeNanos;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/EventReportingArtifacts.java b/src/main/java/com/google/devtools/build/lib/actions/EventReportingArtifacts.java
index e887535..5dbacf6 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/EventReportingArtifacts.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/EventReportingArtifacts.java
@@ -21,7 +21,7 @@
/** Interface for {@link BuildEvent}s reporting artifacts as named sets */
public interface EventReportingArtifacts extends BuildEvent {
- /** Pair of artifacts and a @{link CompletionContext}. */
+ /** Pair of artifacts and a {@link CompletionContext}. */
class ReportedArtifacts {
public final Collection<NestedSet<Artifact>> artifacts;
public final CompletionContext completionContext;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/RunningActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/RunningActionEvent.java
index aab8ca5..2751236 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/RunningActionEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/RunningActionEvent.java
@@ -16,7 +16,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/**
* Notifies that an in-flight action is running.
@@ -26,7 +26,7 @@
* ScanningActionEvent} and {@link SchedulingActionEvent} events. TODO(jmmv): But this theory is not
* true today. Investigate.
*/
-public class RunningActionEvent implements ProgressLike {
+public final class RunningActionEvent implements Postable {
private final ActionExecutionMetadata action;
private final String strategy;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ScanningActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ScanningActionEvent.java
index 61b8a33..c802c14 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ScanningActionEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ScanningActionEvent.java
@@ -14,14 +14,14 @@
package com.google.devtools.build.lib.actions;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/**
* Notifies that an in-flight action has started being scanned for discovered inputs.
*
* <p>This phase ends when an {@link StoppedScanningActionEvent} is posted for this action.
*/
-public class ScanningActionEvent implements ProgressLike {
+public final class ScanningActionEvent implements Postable {
private final ActionExecutionMetadata action;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/SchedulingActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/SchedulingActionEvent.java
index 3c04b00..6ed4b29 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/SchedulingActionEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/SchedulingActionEvent.java
@@ -16,7 +16,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/**
* Notifies that an in-flight action is being scheduled.
@@ -25,7 +25,7 @@
* ActionCompletionEvent} events, and should only appear after a corresponding {@link
* ScanningActionEvent}. TODO(jmmv): But this theory is not true today. Investigate.
*/
-public class SchedulingActionEvent implements ProgressLike {
+public final class SchedulingActionEvent implements Postable {
private final ActionExecutionMetadata action;
private final String strategy;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/SpawnExecutedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/SpawnExecutedEvent.java
index e25004b..29ad0f0 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/SpawnExecutedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/SpawnExecutedEvent.java
@@ -19,7 +19,7 @@
import java.time.Instant;
/** This event is fired during the build, when a subprocess is executed. */
-public class SpawnExecutedEvent implements ExtendedEventHandler.ProgressLike {
+public final class SpawnExecutedEvent implements ExtendedEventHandler.Postable {
private final Spawn spawn;
private final SpawnResult result;
private final Instant startTimeInstant;
@@ -58,11 +58,11 @@
/**
* This event is fired to differentiate actions with multiple spawns that are run sequentially
* versus parallel. An example of a use case of why this would be important is if we have flaky
- * tests. We want to tell the {@link CriticalPathComponent} that all the failed test spawns should
- * have their Duration metrics aggregated so the test runtime matches the runtime of the entire
- * CriticalPathComponent.
+ * tests. We want to tell the {@link com.google.devtools.build.lib.runtime.CriticalPathComponent}
+ * that all the failed test spawns should have their Duration metrics aggregated so the test
+ * runtime matches the runtime of the entire CriticalPathComponent.
*/
- public static class ChangePhase implements ExtendedEventHandler.ProgressLike {
+ public static final class ChangePhase implements ExtendedEventHandler.Postable {
private final Action action;
public ChangePhase(Action action) {
diff --git a/src/main/java/com/google/devtools/build/lib/actions/StoppedScanningActionEvent.java b/src/main/java/com/google/devtools/build/lib/actions/StoppedScanningActionEvent.java
index 90a718d..e675e43 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/StoppedScanningActionEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/StoppedScanningActionEvent.java
@@ -17,7 +17,7 @@
import com.google.devtools.build.lib.events.ExtendedEventHandler;
/** Counterpart to {@link ScanningActionEvent}: indicates that scanning is over. */
-public class StoppedScanningActionEvent implements ExtendedEventHandler.ProgressLike {
+public final class StoppedScanningActionEvent implements ExtendedEventHandler.Postable {
private final Action action;
public StoppedScanningActionEvent(Action action) {
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisRootCauseEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisRootCauseEvent.java
index a796ea9..6322462 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisRootCauseEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisRootCauseEvent.java
@@ -34,7 +34,7 @@
* avoid duplicating error messages in the stream if multiple targets fail due to the same root
* cause. It also allows UIs to collate errors by root cause.
*/
-public class AnalysisRootCauseEvent implements BuildEventWithConfiguration {
+public final class AnalysisRootCauseEvent implements BuildEventWithConfiguration {
private final BuildConfigurationValue configuration;
private final Label label;
private final String errorMessage;
@@ -62,7 +62,7 @@
@Override
public Collection<BuildEventId> getChildrenEvents() {
- return ImmutableList.<BuildEventId>of();
+ return ImmutableList.of();
}
@Override
@@ -86,4 +86,9 @@
}
return result;
}
+
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java
index 2d404ed..222bdf6 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java
@@ -37,7 +37,7 @@
import javax.annotation.Nullable;
/** This event is fired as soon as a top-level aspect is either built or fails. */
-public class AspectCompleteEvent
+public final class AspectCompleteEvent
implements SkyValue, BuildEventWithOrderConstraint, EventReportingArtifacts {
private final AspectKey aspectKey;
private final AspectDescriptor descriptor;
@@ -170,4 +170,9 @@
/*baselineCoverageArtifacts=*/ null));
return GenericBuildEvent.protoChaining(this).setCompleted(builder.build()).build();
}
+
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildInfoEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildInfoEvent.java
index 3544319..3d7680a 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BuildInfoEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildInfoEvent.java
@@ -28,7 +28,7 @@
/** This event is fired once build info data is available. */
public final class BuildInfoEvent
- implements BuildEventWithOrderConstraint, ExtendedEventHandler.ProgressLike {
+ implements BuildEventWithOrderConstraint, ExtendedEventHandler.Postable {
private final Map<String, String> buildInfoMap;
/**
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 bf57e5e..23be281 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
@@ -496,6 +496,11 @@
return toReportedArtifacts(outputs, completionContext, baselineCoverageArtifacts);
}
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
+
static ReportedArtifacts toReportedArtifacts(
ImmutableMap<String, ArtifactsInOutputGroup> outputs,
CompletionContext completionContext,
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/XcodeConfigEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/XcodeConfigEvent.java
index fb0969f..fc2b083 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/XcodeConfigEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/XcodeConfigEvent.java
@@ -17,10 +17,15 @@
import com.google.devtools.build.lib.xcode.proto.XcodeConfig.XcodeConfigRuleInfo;
/** Carries the information passed to an {@code xcode_config} rule for logging purposes. */
-public class XcodeConfigEvent implements Postable {
+public final class XcodeConfigEvent implements Postable {
public final XcodeConfigRuleInfo xcodeConfigInfo;
public XcodeConfigEvent(XcodeConfigRuleInfo xcodeConfigInfo) {
this.xcodeConfigInfo = xcodeConfigInfo;
}
+
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/BaselineCoverageResult.java b/src/main/java/com/google/devtools/build/lib/analysis/test/BaselineCoverageResult.java
index 0c33fcc..c18f37c 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/test/BaselineCoverageResult.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/test/BaselineCoverageResult.java
@@ -19,7 +19,7 @@
import com.google.devtools.build.lib.events.ExtendedEventHandler;
/** This event is used to notify about a successfully built baseline coverage artifact. */
-public class BaselineCoverageResult implements ExtendedEventHandler.ProgressLike {
+public final class BaselineCoverageResult implements ExtendedEventHandler.Postable {
private final Artifact baselineCoverageData;
private final String ownerString;
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestResult.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestResult.java
index 250391f..dc07cc9 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestResult.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestResult.java
@@ -41,7 +41,7 @@
*/
@ThreadSafe
@Immutable
-public class TestResult implements ExtendedEventHandler.ProgressLike {
+public class TestResult implements ExtendedEventHandler.Postable {
private final TestRunnerAction testAction;
private final TestResultData data;
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/ResolvedEvent.java b/src/main/java/com/google/devtools/build/lib/bazel/ResolvedEvent.java
index 087f8e5..7469564 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/ResolvedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/ResolvedEvent.java
@@ -18,7 +18,7 @@
import com.google.devtools.build.lib.vfs.XattrProvider;
/** Interface for events reporting information to be added to a resolved file. */
-public interface ResolvedEvent extends ExtendedEventHandler.ProgressLike {
+public interface ResolvedEvent extends ExtendedEventHandler.Postable {
/** The name of the resolved entity, e.g., the name of an external repository. */
String getName();
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/debug/WorkspaceRuleEvent.java b/src/main/java/com/google/devtools/build/lib/bazel/debug/WorkspaceRuleEvent.java
index 1973da3..a0dce42 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/debug/WorkspaceRuleEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/debug/WorkspaceRuleEvent.java
@@ -20,14 +20,14 @@
import com.google.devtools.build.lib.bazel.debug.proto.WorkspaceLogProtos.SymlinkEvent;
import com.google.devtools.build.lib.bazel.debug.proto.WorkspaceLogProtos.TemplateEvent;
import com.google.devtools.build.lib.bazel.debug.proto.WorkspaceLogProtos.WhichEvent;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
import java.net.URL;
import java.util.List;
import java.util.Map;
import net.starlark.java.syntax.Location;
/** An event to record events happening during workspace rule resolution */
-public final class WorkspaceRuleEvent implements ProgressLike {
+public final class WorkspaceRuleEvent implements Postable {
WorkspaceLogProtos.WorkspaceEvent event;
public WorkspaceLogProtos.WorkspaceEvent getLogEvent() {
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheHitEvent.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheHitEvent.java
index 25dca96..aeb3b1d 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheHitEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheHitEvent.java
@@ -15,11 +15,11 @@
package com.google.devtools.build.lib.bazel.repository.cache;
import com.google.devtools.build.lib.cmdline.RepositoryName;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
import java.net.URL;
/** Event reporting about cache hits for download requests. */
-public class RepositoryCacheHitEvent implements ProgressLike {
+public final class RepositoryCacheHitEvent implements Postable {
private final RepositoryName repo;
private final String hash;
private final URL url;
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryDefinitionLocationEvent.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryDefinitionLocationEvent.java
index 91fe103..adacf49 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryDefinitionLocationEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryDefinitionLocationEvent.java
@@ -13,10 +13,10 @@
// limitations under the License.
package com.google.devtools.build.lib.bazel.repository.starlark;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/** Event reporting about the place where a Starlark repository rule was defined. */
-public class StarlarkRepositoryDefinitionLocationEvent implements ProgressLike {
+public final class StarlarkRepositoryDefinitionLocationEvent implements Postable {
private final String name;
private final String definitionInformation;
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/FetchEvent.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/FetchEvent.java
index 7d52aef..c5e995c 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventstream/FetchEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/FetchEvent.java
@@ -26,7 +26,7 @@
* that use a cached copy of the resource to download. In way, these events allow keeping track of
* the access of external resources.
*/
-public final class FetchEvent implements BuildEvent, ExtendedEventHandler.ProgressLike {
+public final class FetchEvent implements BuildEvent, ExtendedEventHandler.Postable {
private final String url;
private final boolean success;
diff --git a/src/main/java/com/google/devtools/build/lib/events/ExtendedEventHandler.java b/src/main/java/com/google/devtools/build/lib/events/ExtendedEventHandler.java
index 34a7e26..435f57a 100644
--- a/src/main/java/com/google/devtools/build/lib/events/ExtendedEventHandler.java
+++ b/src/main/java/com/google/devtools/build/lib/events/ExtendedEventHandler.java
@@ -20,20 +20,33 @@
*/
public interface ExtendedEventHandler extends EventHandler {
- /** Interface for declaring events that can be posted via the extended event handler */
- interface Postable {}
+ /** An event that can be posted via the extended event handler. */
+ interface Postable {
- /** Post an postable object with more refined information about an important build event */
+ /**
+ * If this post originated from {@link
+ * com.google.devtools.build.skyframe.SkyFunction.Environment#getListener}, whether it should be
+ * stored in the corresponding Skyframe node to be replayed on incremental builds when the node
+ * is deemed up-to-date.
+ *
+ * <p>Posts which are crucial to the correctness of the evaluation should return {@code true} so
+ * that they are replayed when the {@link com.google.devtools.build.skyframe.SkyFunction}
+ * invocation is cached. On the other hand, posts that are merely informational (such as a
+ * progress update) should return {@code false} to avoid taking up memory.
+ *
+ * <p>This method is not relevant for posts which do not originate from {@link
+ * com.google.devtools.build.skyframe.SkyFunction} evaluation.
+ */
+ default boolean storeForReplay() {
+ return false;
+ }
+ }
+
+ /** Posts a {@link Postable} object about an important build event. */
void post(Postable obj);
- /**
- * Interface for declaring postable events that report about progress (as opposed to success or
- * failure) and hence should not be stored and replayed.
- */
- interface ProgressLike extends Postable {}
-
- /** Interface for progress events that report about fetching from a remote site */
- interface FetchProgress extends ProgressLike {
+ /** A progress event that reports about fetching from a remote site. */
+ interface FetchProgress extends Postable {
/**
* The resource that was originally requested and uniquely determines the fetch source. The
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseCompleteEvent.java
index e4ad0ec..aad9f72 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseCompleteEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseCompleteEvent.java
@@ -52,4 +52,9 @@
public ImmutableSet<Label> getFilteredLabels() {
return filteredLabels;
}
+
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
}
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/ParsingFailedEvent.java b/src/main/java/com/google/devtools/build/lib/pkgcache/ParsingFailedEvent.java
index 64e7e02..59a829e 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/ParsingFailedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/ParsingFailedEvent.java
@@ -41,4 +41,9 @@
public String getMessage() {
return message;
}
+
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
}
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/TargetParsingCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/pkgcache/TargetParsingCompleteEvent.java
index 9d2a7cc..9c1ba08 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/TargetParsingCompleteEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/TargetParsingCompleteEvent.java
@@ -35,9 +35,9 @@
import javax.annotation.Nullable;
/** This event is fired just after target pattern evaluation is completed. */
-public class TargetParsingCompleteEvent implements BuildEventWithOrderConstraint {
+public final class TargetParsingCompleteEvent implements BuildEventWithOrderConstraint {
/** A target-like object that is lighter than a target but has all data needed by callers. */
- public static class ThinTarget {
+ public static final class ThinTarget {
private final Label label;
@Nullable private final String ruleClass;
private final String targetKind;
@@ -191,6 +191,11 @@
return GenericBuildEvent.protoChaining(this).setExpanded(expanded).build();
}
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
+
private static ImmutableSet<ThinTarget> asThinTargets(Collection<Target> targets) {
return targets.stream().map(ThinTarget::new).collect(ImmutableSet.toImmutableSet());
}
diff --git a/src/main/java/com/google/devtools/build/lib/repository/RepositoryFailedEvent.java b/src/main/java/com/google/devtools/build/lib/repository/RepositoryFailedEvent.java
index 5db49f0..e2c313c 100644
--- a/src/main/java/com/google/devtools/build/lib/repository/RepositoryFailedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/repository/RepositoryFailedEvent.java
@@ -25,14 +25,13 @@
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.RepositoryName;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
import java.util.Collection;
/**
* Event indicating that a failure is related to a given external repository; this is in particular
* the case, if fetching that repository failed.
*/
-public class RepositoryFailedEvent implements ProgressLike, BuildEvent {
+public final class RepositoryFailedEvent implements BuildEvent {
private final RepositoryName repo;
private final String message;
@@ -61,7 +60,7 @@
@Override
public Collection<BuildEventId> getChildrenEvents() {
- return ImmutableList.<BuildEventId>of();
+ return ImmutableList.of();
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
index 94255ca..23d0a70 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
@@ -216,8 +216,8 @@
ActionExecutionState previousExecution = skyframeActionExecutor.probeActionExecution(action);
// If this action was previously completed this build, then this evaluation must be happening
- // because of rewinding. Prevent any ProgressLike events from being published a second time for
- // this action; downstream consumers of action events reasonably don't expect them.
+ // because of rewinding. Prevent any progress events from being published a second time for this
+ // action; downstream consumers of action events reasonably don't expect them.
if (!skyframeActionExecutor.shouldEmitProgressEvents(action)) {
env = new ProgressEventSuppressingEnvironment(env);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectCompletor.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectCompletor.java
index 4f13033..1b201a2 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectCompletor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectCompletor.java
@@ -109,7 +109,7 @@
}
@Override
- public ExtendedEventHandler.Postable createSucceeded(
+ public AspectCompleteEvent createSucceeded(
AspectCompletionKey skyKey,
AspectValue value,
CompletionContext completionContext,
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
index 86b3f16..df7cb75 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
@@ -24,6 +24,7 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
import com.google.devtools.build.lib.actions.CompletionContext;
import com.google.devtools.build.lib.actions.CompletionContext.PathResolverFactory;
+import com.google.devtools.build.lib.actions.EventReportingArtifacts;
import com.google.devtools.build.lib.actions.FilesetOutputSymlink;
import com.google.devtools.build.lib.actions.InputFileErrorException;
import com.google.devtools.build.lib.analysis.ConfiguredObjectValue;
@@ -112,7 +113,7 @@
/** Creates a succeeded completion value; returns null if skyframe found missing values. */
@Nullable
- ExtendedEventHandler.Postable createSucceeded(
+ EventReportingArtifacts createSucceeded(
KeyT skyKey,
ValueT value,
CompletionContext completionContext,
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PatternExpandingError.java b/src/main/java/com/google/devtools/build/lib/skyframe/PatternExpandingError.java
index 2b04458..8de0915 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PatternExpandingError.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PatternExpandingError.java
@@ -81,4 +81,9 @@
.build();
return GenericBuildEvent.protoChaining(this).setAborted(failure).build();
}
+
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ProgressEventSuppressingEnvironment.java b/src/main/java/com/google/devtools/build/lib/skyframe/ProgressEventSuppressingEnvironment.java
index b8cc148..5a3a148 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ProgressEventSuppressingEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ProgressEventSuppressingEnvironment.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.lib.skyframe;
import com.google.common.util.concurrent.ListenableFuture;
-import com.google.devtools.build.lib.events.ExtendedEventHandler;
import com.google.devtools.build.lib.util.GroupedList;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
@@ -26,9 +25,8 @@
import javax.annotation.Nullable;
/**
- * A {@link SkyFunction.Environment} which returns a {@link
- * ExtendedEventHandler.ProgressLike}-suppressing {@link ExtendedEventHandler} from {@link
- * #getListener()}.
+ * A {@link SkyFunction.Environment} which returns a {@link ProgressSuppressingEventHandler} from
+ * #getListener}.
*
* <p>Otherwise, delegates calls to its wrapped {@link SkyFunction.Environment}.
*/
@@ -43,7 +41,7 @@
}
@Override
- public ExtendedEventHandler getListener() {
+ public ProgressSuppressingEventHandler getListener() {
return suppressingEventHandler;
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ProgressSuppressingEventHandler.java b/src/main/java/com/google/devtools/build/lib/skyframe/ProgressSuppressingEventHandler.java
index de92277..3fbcff1 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ProgressSuppressingEventHandler.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ProgressSuppressingEventHandler.java
@@ -18,10 +18,11 @@
import com.google.devtools.build.lib.events.ExtendedEventHandler;
/**
- * Suppresses {@link #post} when the provided {@link ExtendedEventHandler.Postable} is a {@link
- * ProgressLike}, but otherwise delegates calls to its wrapped {@link ExtendedEventHandler}.
+ * Suppresses {@link #post} when the provided {@link Postable} represents a progress event (denoted
+ * by a return of {@code false} from {@link Postable#storeForReplay}), but otherwise delegates calls
+ * to its wrapped {@link ExtendedEventHandler}.
*/
-class ProgressSuppressingEventHandler implements ExtendedEventHandler {
+final class ProgressSuppressingEventHandler implements ExtendedEventHandler {
private final ExtendedEventHandler delegate;
ProgressSuppressingEventHandler(ExtendedEventHandler listener) {
@@ -30,10 +31,9 @@
@Override
public void post(Postable obj) {
- if (obj instanceof ProgressLike) {
- return;
+ if (obj.storeForReplay()) {
+ delegate.post(obj);
}
- delegate.post(obj);
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
index 41f2e8d..9c98f45 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
@@ -174,9 +174,9 @@
private ConcurrentMap<OwnerlessArtifactWrapper, ActionExecutionState> buildActionMap;
// We also keep track of actions which were reset this build from a previously-completed state.
- // When re-evaluated, these actions should not emit ProgressLike events, in order to not confuse
- // the downstream consumers of action-related event streams, which may (reasonably) have expected
- // an action to be executed at most once per build.
+ // When re-evaluated, these actions should not emit progress events, in order to not confuse the
+ // downstream consumers of action-related event streams, which may (reasonably) have expected an
+ // action to be executed at most once per build.
//
// Note: actions which fail due to lost inputs, and get rewound, will not have any events
// suppressed during their second evaluation. Consumers of events which get emitted before
@@ -962,11 +962,11 @@
// env.getListener
// Apparently, one isn't enough.
//
- // At this time, ProgressLike events that are generated in this class should be posted to
- // env.getListener, while ProgressLike events that are generated in the Action implementation
- // are posted to actionExecutionContext.getEventHandler. The reason for this seems to be
- // action rewinding, which suppresses progress on actionExecutionContext.getEventHandler, for
- // undocumented reasons.
+ // Progress events that are generated in this class should be posted to env.getListener, while
+ // progress events that are generated in the Action implementation are posted to
+ // actionExecutionContext.getEventHandler. The reason for this is action rewinding, in which
+ // case env.getListener may be a ProgressSuppressingEventHandler. See shouldEmitProgressEvents
+ // and completedAndResetActions.
//
// It is also unclear why we are posting anything directly to reporter. That probably
// shouldn't happen.
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SourceDirectoryEvent.java b/src/main/java/com/google/devtools/build/lib/skyframe/SourceDirectoryEvent.java
index 73fdf17..aaf701a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SourceDirectoryEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SourceDirectoryEvent.java
@@ -15,12 +15,12 @@
package com.google.devtools.build.lib.skyframe;
import com.google.auto.value.AutoValue;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
import com.google.devtools.build.lib.vfs.PathFragment;
/** Event issued when a source directory is encountered in {@link ArtifactFunction}. */
@AutoValue
-public abstract class SourceDirectoryEvent implements ProgressLike {
+public abstract class SourceDirectoryEvent implements Postable {
public abstract PathFragment execPath();
public static SourceDirectoryEvent create(PathFragment execPath) {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletor.java b/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletor.java
index 51e95c8..1d81212 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletor.java
@@ -118,7 +118,7 @@
@Override
@Nullable
- public ExtendedEventHandler.Postable createSucceeded(
+ public TargetCompleteEvent createSucceeded(
TargetCompletionKey skyKey,
ConfiguredTargetValue value,
CompletionContext completionContext,
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TopLevelStatusEvents.java b/src/main/java/com/google/devtools/build/lib/skyframe/TopLevelStatusEvents.java
index bf4deed..181874d 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TopLevelStatusEvents.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TopLevelStatusEvents.java
@@ -17,7 +17,7 @@
import com.google.devtools.build.lib.analysis.ConfiguredAspect;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.config.BuildConfigurationValue;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
import com.google.devtools.build.lib.skyframe.AspectKeyCreator.AspectKey;
/**
@@ -35,7 +35,7 @@
/** An event that marks the successful analysis of a top-level target, including tests. */
@AutoValue
- public abstract static class TopLevelTargetAnalyzedEvent implements ProgressLike {
+ public abstract static class TopLevelTargetAnalyzedEvent implements Postable {
abstract ConfiguredTarget configuredTarget();
public static TopLevelTargetAnalyzedEvent create(ConfiguredTarget configuredTarget) {
@@ -45,7 +45,7 @@
/** An event that marks the skipping of a top-level target, including skipped tests. */
@AutoValue
- public abstract static class TopLevelTargetSkippedEvent implements ProgressLike {
+ public abstract static class TopLevelTargetSkippedEvent implements Postable {
abstract ConfiguredTarget configuredTarget();
public static TopLevelTargetSkippedEvent create(ConfiguredTarget configuredTarget) {
@@ -55,7 +55,7 @@
/** An event that marks the successful build of a top-level target, including tests. */
@AutoValue
- public abstract static class TopLevelTargetBuiltEvent implements ProgressLike {
+ public abstract static class TopLevelTargetBuiltEvent implements Postable {
abstract ConfiguredTargetKey configuredTargetKey();
public static TopLevelTargetBuiltEvent create(ConfiguredTargetKey configuredTargetKey) {
@@ -65,7 +65,7 @@
/** An event that marks the successful analysis of a test target. */
@AutoValue
- public abstract static class TestAnalyzedEvent implements ProgressLike {
+ public abstract static class TestAnalyzedEvent implements Postable {
public abstract ConfiguredTarget configuredTarget();
public abstract BuildConfigurationValue buildConfigurationValue();
@@ -83,7 +83,7 @@
/** An event that marks the successful analysis of an aspect. */
@AutoValue
- public abstract static class AspectAnalyzedEvent implements ProgressLike {
+ public abstract static class AspectAnalyzedEvent implements Postable {
abstract AspectKey aspectKey();
abstract ConfiguredAspect configuredAspect();
@@ -96,7 +96,7 @@
/** An event that marks the successful building of an aspect. */
@AutoValue
- public abstract static class AspectBuiltEvent implements ProgressLike {
+ public abstract static class AspectBuiltEvent implements Postable {
abstract AspectKey aspectKey();
public static AspectBuiltEvent create(AspectKey aspectKey) {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/rewinding/ActionRewoundEvent.java b/src/main/java/com/google/devtools/build/lib/skyframe/rewinding/ActionRewoundEvent.java
index 76c9af1..fe0ac35 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/rewinding/ActionRewoundEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/rewinding/ActionRewoundEvent.java
@@ -14,13 +14,13 @@
package com.google.devtools.build.lib.skyframe.rewinding;
import com.google.devtools.build.lib.actions.Action;
-import com.google.devtools.build.lib.events.ExtendedEventHandler.ProgressLike;
+import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable;
/**
* This event is fired during the build for an action that failed because of lost inputs, and that
* will try to recover through rewinding (see {@link ActionRewindStrategy}).
*/
-public final class ActionRewoundEvent implements ProgressLike {
+public final class ActionRewoundEvent implements Postable {
private final long relativeActionStartTime;
private final Action failedRewoundAction;
diff --git a/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java b/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java
index ba5aad8..07bab89 100644
--- a/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java
+++ b/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java
@@ -142,12 +142,12 @@
@Override
@SuppressWarnings("UnsynchronizedOverridesSynchronized") // only delegates to thread-safe.
- public void post(ExtendedEventHandler.Postable e) {
+ public void post(Postable p) {
checkActive();
- if (e instanceof ExtendedEventHandler.ProgressLike) {
- evaluatorContext.getReporter().post(e);
+ if (p.storeForReplay()) {
+ super.post(p);
} else {
- super.post(e);
+ evaluatorContext.getReporter().post(p);
}
}
};
diff --git a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java
index c592969..67e4378 100644
--- a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java
@@ -637,7 +637,13 @@
@Test
public void postableFromDoneChildRecorded() throws Exception {
graph = new InMemoryGraphImpl();
- Postable post = new Postable() {};
+ Postable post =
+ new Postable() {
+ @Override
+ public boolean storeForReplay() {
+ return true;
+ }
+ };
set("a", "a").setPostable(post);
SkyKey a = GraphTester.toSkyKey("a");
SkyKey top = GraphTester.toSkyKey("top");