use of org.gradle.internal.execution.history.impl.DefaultBeforeExecutionState in project gradle by gradle.
the class CaptureStateBeforeExecutionStep method captureExecutionStateWithOutputs.
private BeforeExecutionState captureExecutionStateWithOutputs(UnitOfWork work, PreviousExecutionContext context, ImmutableSortedMap<String, FileSystemSnapshot> unfilteredOutputSnapshots) {
Optional<PreviousExecutionState> previousExecutionState = context.getPreviousExecutionState();
ImplementationsBuilder implementationsBuilder = new ImplementationsBuilder(classLoaderHierarchyHasher);
work.visitImplementations(implementationsBuilder);
ImplementationSnapshot implementation = implementationsBuilder.getImplementation();
ImmutableList<ImplementationSnapshot> additionalImplementations = implementationsBuilder.getAdditionalImplementations();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Implementation for {}: {}", work.getDisplayName(), implementation);
LOGGER.debug("Additional implementations for {}: {}", work.getDisplayName(), additionalImplementations);
}
ImmutableSortedMap<String, ValueSnapshot> previousInputProperties = previousExecutionState.map(InputExecutionState::getInputProperties).orElse(ImmutableSortedMap.of());
ImmutableSortedMap<String, ? extends FileCollectionFingerprint> previousInputFileFingerprints = previousExecutionState.map(InputExecutionState::getInputFileProperties).orElse(ImmutableSortedMap.of());
ImmutableSortedMap<String, FileSystemSnapshot> previousOutputSnapshots = previousExecutionState.map(PreviousExecutionState::getOutputFilesProducedByWork).orElse(ImmutableSortedMap.of());
OverlappingOutputs overlappingOutputs;
switch(work.getOverlappingOutputHandling()) {
case DETECT_OVERLAPS:
overlappingOutputs = overlappingOutputDetector.detect(previousOutputSnapshots, unfilteredOutputSnapshots);
break;
case IGNORE_OVERLAPS:
overlappingOutputs = null;
break;
default:
throw new AssertionError();
}
InputFingerprinter.Result newInputs = work.getInputFingerprinter().fingerprintInputProperties(previousInputProperties, previousInputFileFingerprints, context.getInputProperties(), context.getInputFileProperties(), work::visitRegularInputs);
return new DefaultBeforeExecutionState(implementation, additionalImplementations, newInputs.getAllValueSnapshots(), newInputs.getAllFileFingerprints(), unfilteredOutputSnapshots, overlappingOutputs);
}
Aggregations