Search in sources :

Example 1 with OutputFileSnapshottingException

use of org.gradle.internal.execution.OutputSnapshotter.OutputFileSnapshottingException in project gradle by gradle.

the class CaptureStateBeforeExecutionStep method captureExecutionState.

@Nonnull
private Optional<BeforeExecutionState> captureExecutionState(UnitOfWork work, PreviousExecutionContext context) {
    return operation(operationContext -> {
        ImmutableSortedMap<String, FileSystemSnapshot> unfilteredOutputSnapshots;
        try {
            unfilteredOutputSnapshots = outputSnapshotter.snapshotOutputs(work, context.getWorkspace());
        } catch (OutputFileSnapshottingException e) {
            work.handleUnreadableOutputs(e);
            operationContext.setResult(Operation.Result.INSTANCE);
            return Optional.empty();
        }
        try {
            BeforeExecutionState executionState = captureExecutionStateWithOutputs(work, context, unfilteredOutputSnapshots);
            operationContext.setResult(Operation.Result.INSTANCE);
            return Optional.of(executionState);
        } catch (InputFileFingerprintingException e) {
            // Note that we let InputFingerprintException fall through as we've already
            // been failing for non-file value fingerprinting problems even for tasks
            work.handleUnreadableInputs(e);
            operationContext.setResult(Operation.Result.INSTANCE);
            return Optional.empty();
        }
    }, BuildOperationDescriptor.displayName("Snapshot inputs and outputs before executing " + work.getDisplayName()).details(Operation.Details.INSTANCE));
}
Also used : InputFileFingerprintingException(org.gradle.internal.execution.fingerprint.InputFingerprinter.InputFileFingerprintingException) OutputFileSnapshottingException(org.gradle.internal.execution.OutputSnapshotter.OutputFileSnapshottingException) FileSystemSnapshot(org.gradle.internal.snapshot.FileSystemSnapshot) BeforeExecutionState(org.gradle.internal.execution.history.BeforeExecutionState) DefaultBeforeExecutionState(org.gradle.internal.execution.history.impl.DefaultBeforeExecutionState) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)1 OutputFileSnapshottingException (org.gradle.internal.execution.OutputSnapshotter.OutputFileSnapshottingException)1 InputFileFingerprintingException (org.gradle.internal.execution.fingerprint.InputFingerprinter.InputFileFingerprintingException)1 BeforeExecutionState (org.gradle.internal.execution.history.BeforeExecutionState)1 DefaultBeforeExecutionState (org.gradle.internal.execution.history.impl.DefaultBeforeExecutionState)1 FileSystemSnapshot (org.gradle.internal.snapshot.FileSystemSnapshot)1