use of com.google.devtools.build.lib.actions.ActionCacheChecker.Token in project bazel by bazelbuild.
the class SkyframeActionExecutor method checkActionCache.
/**
* Checks the action cache to see if {@code action} needs to be executed, or is up to date.
* Returns a token with the semantics of {@link ActionCacheChecker#getTokenIfNeedToExecute}: null
* if the action is up to date, and non-null if it needs to be executed, in which case that token
* should be provided to the ActionCacheChecker after execution.
*/
Token checkActionCache(Action action, MetadataHandler metadataHandler, long actionStartTime, Iterable<Artifact> resolvedCacheArtifacts, Map<String, String> clientEnv) {
profiler.startTask(ProfilerTask.ACTION_CHECK, action);
Token token = actionCacheChecker.getTokenIfNeedToExecute(action, resolvedCacheArtifacts, clientEnv, explain ? reporter : null, metadataHandler);
profiler.completeTask(ProfilerTask.ACTION_CHECK);
if (token == null) {
boolean eventPosted = false;
// Notify BlazeRuntimeStatistics about the action middleman 'execution'.
if (action.getActionType().isMiddleman()) {
postEvent(new ActionMiddlemanEvent(action, actionStartTime));
eventPosted = true;
}
if (action instanceof NotifyOnActionCacheHit) {
NotifyOnActionCacheHit notify = (NotifyOnActionCacheHit) action;
notify.actionCacheHit(executorEngine);
}
// We still need to check the outputs so that output file data is available to the value.
checkOutputs(action, metadataHandler);
if (!eventPosted) {
postEvent(new CachedActionEvent(action, actionStartTime));
}
}
return token;
}
Aggregations