use of org.gradle.internal.execution.history.changes.InputChangesInternal in project gradle by gradle.
the class ResolveInputChangesStep method determineInputChanges.
private static Optional<InputChangesInternal> determineInputChanges(UnitOfWork work, IncrementalChangesContext context) {
if (!work.getInputChangeTrackingStrategy().requiresInputChanges()) {
return Optional.empty();
}
ExecutionStateChanges changes = context.getChanges().orElseThrow(() -> new IllegalStateException("Changes are not tracked, unable determine incremental changes."));
InputChangesInternal inputChanges = changes.createInputChanges();
if (!inputChanges.isIncremental()) {
LOGGER.info("The input changes require a full rebuild for incremental {}.", work.getDisplayName());
}
return Optional.of(inputChanges);
}
use of org.gradle.internal.execution.history.changes.InputChangesInternal in project gradle by gradle.
the class ExecuteStep method executeInternal.
private static Result executeInternal(UnitOfWork work, InputChangesContext context) {
UnitOfWork.ExecutionRequest executionRequest = new UnitOfWork.ExecutionRequest() {
@Override
public File getWorkspace() {
return context.getWorkspace();
}
@Override
public Optional<InputChangesInternal> getInputChanges() {
return context.getInputChanges();
}
@Override
public Optional<ImmutableSortedMap<String, FileSystemSnapshot>> getPreviouslyProducedOutputs() {
return context.getPreviousExecutionState().map(PreviousExecutionState::getOutputFilesProducedByWork);
}
};
UnitOfWork.WorkOutput workOutput;
Timer timer = Time.startTimer();
try {
workOutput = work.execute(executionRequest);
} catch (Throwable t) {
return ResultImpl.failed(t, Duration.ofMillis(timer.getElapsedMillis()));
}
Duration duration = Duration.ofMillis(timer.getElapsedMillis());
ExecutionOutcome outcome = determineOutcome(context, workOutput);
return ResultImpl.success(duration, new ExecutionResultImpl(outcome, workOutput));
}
use of org.gradle.internal.execution.history.changes.InputChangesInternal in project gradle by gradle.
the class IncrementalTaskInputsTaskAction method doExecute.
@Override
@SuppressWarnings("deprecation")
protected void doExecute(Task task, String methodName) {
InputChangesInternal inputChanges = getInputChanges();
Iterable<InputFileDetails> allFileChanges = inputChanges.getAllFileChanges();
org.gradle.api.tasks.incremental.IncrementalTaskInputs incrementalTaskInputs = inputChanges.isIncremental() ? createIncrementalInputs(allFileChanges) : createRebuildInputs(allFileChanges);
JavaMethod.of(task, Object.class, methodName, org.gradle.api.tasks.incremental.IncrementalTaskInputs.class).invoke(task, incrementalTaskInputs);
}
Aggregations