use of org.gradle.api.internal.TaskOutputsInternal in project gradle by gradle.
the class ResolveTaskArtifactStateTaskExecuter method execute.
@Override
public void execute(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
Timer clock = Time.startTimer();
TaskProperties taskProperties = DefaultTaskProperties.resolve(propertyWalker, resolver, task);
context.setTaskProperties(taskProperties);
TaskArtifactState taskArtifactState = repository.getStateFor(task, taskProperties);
TaskOutputsInternal outputs = task.getOutputs();
context.setTaskArtifactState(taskArtifactState);
outputs.setHistory(taskArtifactState.getExecutionHistory());
LOGGER.debug("Putting task artifact state for {} into context took {}.", task, clock.getElapsed());
try {
executer.execute(task, state, context);
} finally {
outputs.setHistory(null);
context.setTaskArtifactState(null);
context.setTaskProperties(null);
LOGGER.debug("Removed task artifact state for {} from context.");
}
}
use of org.gradle.api.internal.TaskOutputsInternal in project gradle by gradle.
the class TaskExecution method execute.
@Override
public WorkOutput execute(ExecutionRequest executionRequest) {
FileCollection previousFiles = executionRequest.getPreviouslyProducedOutputs().<FileCollection>map(previousOutputs -> new PreviousOutputFileCollection(task, fileCollectionFactory, previousOutputs)).orElseGet(fileCollectionFactory::empty);
TaskOutputsInternal outputs = task.getOutputs();
outputs.setPreviousOutputFiles(previousFiles);
try {
WorkResult didWork = executeWithPreviousOutputFiles(executionRequest.getInputChanges().orElse(null));
return new WorkOutput() {
@Override
public WorkResult getDidWork() {
return didWork;
}
@Override
public Object getOutput() {
throw new UnsupportedOperationException();
}
};
} finally {
outputs.setPreviousOutputFiles(null);
}
}
Aggregations