use of org.gradle.api.execution.internal.TaskInputsListener in project gradle by gradle.
the class TaskExecutionServices method createTaskExecuter.
TaskExecuter createTaskExecuter(TaskArtifactStateRepository repository, TaskOutputPacker packer, BuildCacheService buildCacheService, StartParameter startParameter, ListenerManager listenerManager, GradleInternal gradle, TaskOutputOriginFactory taskOutputOriginFactory, BuildOperationExecutor buildOperationExecutor, AsyncWorkTracker asyncWorkTracker) {
// TODO - need a more comprehensible way to only collect inputs for the outer build
// - we are trying to ignore buildSrc here, but also avoid weirdness with use of GradleBuild tasks
boolean isOuterBuild = gradle.getParent() == null;
TaskInputsListener taskInputsListener = isOuterBuild ? listenerManager.getBroadcaster(TaskInputsListener.class) : TaskInputsListener.NOOP;
boolean taskOutputCacheEnabled = startParameter.isBuildCacheEnabled();
TaskOutputsGenerationListener taskOutputsGenerationListener = listenerManager.getBroadcaster(TaskOutputsGenerationListener.class);
TaskExecuter executer = new ExecuteActionsTaskExecuter(taskOutputsGenerationListener, listenerManager.getBroadcaster(TaskActionListener.class), buildOperationExecutor, asyncWorkTracker);
boolean verifyInputsEnabled = Boolean.getBoolean("org.gradle.tasks.verifyinputs");
if (verifyInputsEnabled) {
executer = new VerifyNoInputChangesTaskExecuter(repository, executer);
}
if (taskOutputCacheEnabled) {
executer = new SkipCachedTaskExecuter(taskOutputOriginFactory, buildCacheService, packer, taskOutputsGenerationListener, executer);
}
executer = new SkipUpToDateTaskExecuter(executer);
if (verifyInputsEnabled || taskOutputCacheEnabled) {
executer = new ResolveBuildCacheKeyExecuter(listenerManager.getBroadcaster(TaskOutputCachingListener.class), executer);
}
executer = new ValidatingTaskExecuter(executer);
executer = new SkipEmptySourceFilesTaskExecuter(taskInputsListener, executer);
executer = new ResolveTaskArtifactStateTaskExecuter(repository, executer);
executer = new SkipTaskWithNoActionsExecuter(executer);
executer = new SkipOnlyIfTaskExecuter(executer);
if (taskOutputCacheEnabled) {
executer = new ResolveTaskOutputCachingStateExecuter(executer);
}
executer = new ExecuteAtMostOnceTaskExecuter(executer);
executer = new CatchExceptionTaskExecuter(executer);
return executer;
}
use of org.gradle.api.execution.internal.TaskInputsListener in project gradle by gradle.
the class ContinuousBuildActionExecuter method executeBuildAndAccumulateInputs.
private Object executeBuildAndAccumulateInputs(BuildAction action, BuildRequestContext requestContext, BuildActionParameters actionParameters, final FileSystemChangeWaiter waiter, ServiceRegistry buildSessionScopeServices) {
TaskInputsListener listener = new TaskInputsListener() {
@Override
public void onExecute(TaskInternal taskInternal, FileCollectionInternal fileSystemInputs) {
FileSystemSubset.Builder fileSystemSubsetBuilder = FileSystemSubset.builder();
fileSystemInputs.registerWatchPoints(fileSystemSubsetBuilder);
waiter.watch(fileSystemSubsetBuilder.build());
}
};
listenerManager.addListener(listener);
try {
return delegate.execute(action, requestContext, actionParameters, buildSessionScopeServices);
} finally {
listenerManager.removeListener(listener);
}
}
Aggregations