aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/actions/NotifyOnActionCacheHit.java
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2017-05-10 06:52:23 -0400
committerGravatar Kristina Chodorow <kchodorow@google.com>2017-05-10 13:37:22 -0400
commit889bbe55d21d646d45c99208d595c7b9566ea662 (patch)
treedc51ad2308d9b1a897c1bc51cef50a95f4585e44 /src/main/java/com/google/devtools/build/lib/actions/NotifyOnActionCacheHit.java
parentf2014a17a2541d98cf319c322ac461cec8082945 (diff)
Add a custom interface for cache hit processing in actions
The new interface mirrors ActionExecutionContext, but is restricted to exactly the parts used right now. I did consider using ActionExecutionContext, but it contains some parts that we don't want to make available for cache hits. The end goal is to allow the build event stream access to artifact metadata, in particular for TestResult and TestSummary events, which in turn requires making artifact metadata available when the TestRunnerAction is a cache hit. PiperOrigin-RevId: 155612573
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/NotifyOnActionCacheHit.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/NotifyOnActionCacheHit.java34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/NotifyOnActionCacheHit.java b/src/main/java/com/google/devtools/build/lib/actions/NotifyOnActionCacheHit.java
index ac58b89f4a..89c9a20c2e 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/NotifyOnActionCacheHit.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/NotifyOnActionCacheHit.java
@@ -14,17 +14,47 @@
package com.google.devtools.build.lib.actions;
+import com.google.common.eventbus.EventBus;
+import com.google.devtools.build.lib.actions.Executor.ActionContext;
+import com.google.devtools.build.lib.events.EventHandler;
+import com.google.devtools.build.lib.vfs.Path;
+
/**
* An action which must know when it is skipped due to an action cache hit.
*
* Use should be rare, as the action graph is a functional model.
*/
public interface NotifyOnActionCacheHit extends Action {
+ /**
+ * A custom interface similar to {@link ActionExecutionContext}, but specific to cache hits.
+ */
+ public interface ActionCachedContext {
+ /**
+ * An event listener to report messages to. Errors that signal a action failure should
+ * use ActionExecutionException.
+ */
+ EventHandler getEventHandler();
+
+ /** The EventBus for the current build. */
+ EventBus getEventBus();
+
+ /**
+ * Returns the execution root. This is the directory underneath which Blaze builds its entire
+ * output working tree, including the source symlink forest. All build actions are executed
+ * relative to this directory.
+ */
+ Path getExecRoot();
+
+ /**
+ * Looks up and returns an action context implementation of the given interface type.
+ */
+ <T extends ActionContext> T getContext(Class<? extends T> type);
+ }
/**
* Called when action has "cache hit", and therefore need not be executed.
*
- * @param executor the executor
+ * @param context the action context for a cache hit
*/
- void actionCacheHit(Executor executor);
+ void actionCacheHit(ActionCachedContext context);
}