Search in sources :

Example 1 with InputChangesInternal

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);
}
Also used : InputChangesInternal(org.gradle.internal.execution.history.changes.InputChangesInternal) ExecutionStateChanges(org.gradle.internal.execution.history.changes.ExecutionStateChanges)

Example 2 with InputChangesInternal

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));
}
Also used : UnitOfWork(org.gradle.internal.execution.UnitOfWork) ExecutionOutcome(org.gradle.internal.execution.ExecutionOutcome) Timer(org.gradle.internal.time.Timer) InputChangesInternal(org.gradle.internal.execution.history.changes.InputChangesInternal) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) Duration(java.time.Duration) PreviousExecutionState(org.gradle.internal.execution.history.PreviousExecutionState)

Example 3 with InputChangesInternal

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);
}
Also used : InputFileDetails(org.gradle.api.tasks.incremental.InputFileDetails) InputChangesInternal(org.gradle.internal.execution.history.changes.InputChangesInternal) RebuildIncrementalTaskInputs(org.gradle.api.internal.changedetection.changes.RebuildIncrementalTaskInputs) ChangesOnlyIncrementalTaskInputs(org.gradle.api.internal.changedetection.changes.ChangesOnlyIncrementalTaskInputs)

Aggregations

InputChangesInternal (org.gradle.internal.execution.history.changes.InputChangesInternal)3 ImmutableSortedMap (com.google.common.collect.ImmutableSortedMap)1 Duration (java.time.Duration)1 ChangesOnlyIncrementalTaskInputs (org.gradle.api.internal.changedetection.changes.ChangesOnlyIncrementalTaskInputs)1 RebuildIncrementalTaskInputs (org.gradle.api.internal.changedetection.changes.RebuildIncrementalTaskInputs)1 InputFileDetails (org.gradle.api.tasks.incremental.InputFileDetails)1 ExecutionOutcome (org.gradle.internal.execution.ExecutionOutcome)1 UnitOfWork (org.gradle.internal.execution.UnitOfWork)1 PreviousExecutionState (org.gradle.internal.execution.history.PreviousExecutionState)1 ExecutionStateChanges (org.gradle.internal.execution.history.changes.ExecutionStateChanges)1 Timer (org.gradle.internal.time.Timer)1