use of org.gradle.api.internal.OverlappingOutputs in project gradle by gradle.
the class CacheBackedTaskHistoryRepository method createExecution.
private CurrentTaskExecution createExecution(TaskInternal task, TaskProperties taskProperties, @Nullable HistoricalTaskExecution previousExecution, InputNormalizationStrategy normalizationStrategy) {
Class<? extends TaskInternal> taskClass = task.getClass();
List<ContextAwareTaskAction> taskActions = task.getTaskActions();
ImplementationSnapshot taskImplementation = new ImplementationSnapshot(taskClass.getName(), classLoaderHierarchyHasher.getClassLoaderHash(taskClass.getClassLoader()));
ImmutableList<ImplementationSnapshot> taskActionImplementations = collectActionImplementations(taskActions, classLoaderHierarchyHasher);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Implementation for {}: {}", task, taskImplementation);
LOGGER.debug("Action implementations for {}: {}", task, taskActionImplementations);
}
ImmutableSortedMap<String, ValueSnapshot> previousInputProperties = previousExecution == null ? ImmutableSortedMap.<String, ValueSnapshot>of() : previousExecution.getInputProperties();
ImmutableSortedMap<String, ValueSnapshot> inputProperties = snapshotTaskInputProperties(task, taskProperties, previousInputProperties, valueSnapshotter);
ImmutableSortedSet<String> outputPropertyNames = getOutputPropertyNamesForCacheKey(taskProperties);
ImmutableSet<String> declaredOutputFilePaths = getDeclaredOutputFilePaths(taskProperties, stringInterner);
ImmutableSortedMap<String, FileCollectionSnapshot> inputFiles = snapshotTaskFiles(task, "Input", normalizationStrategy, taskProperties.getInputFileProperties(), snapshotterRegistry);
ImmutableSortedMap<String, FileCollectionSnapshot> outputFiles = snapshotTaskFiles(task, "Output", normalizationStrategy, taskProperties.getOutputFileProperties(), snapshotterRegistry);
FileCollectionSnapshot previousDiscoveredInputs = previousExecution == null ? null : previousExecution.getDiscoveredInputFilesSnapshot();
FileCollectionSnapshot discoveredInputs;
if (previousDiscoveredInputs != null) {
discoveredInputs = snapshotDiscoveredInputs(task, normalizationStrategy, previousDiscoveredInputs.getElements(), snapshotterRegistry, fileCollectionFactory);
} else {
discoveredInputs = EmptyFileCollectionSnapshot.INSTANCE;
}
OverlappingOutputs overlappingOutputs = detectOverlappingOutputs(outputFiles, previousExecution);
return new CurrentTaskExecution(taskImplementation, taskActionImplementations, inputProperties, outputPropertyNames, declaredOutputFilePaths, inputFiles, discoveredInputs, outputFiles, overlappingOutputs);
}
use of org.gradle.api.internal.OverlappingOutputs in project gradle by gradle.
the class CacheBackedTaskHistoryRepository method detectOverlappingOutputs.
@Nullable
private static OverlappingOutputs detectOverlappingOutputs(ImmutableSortedMap<String, FileCollectionSnapshot> taskOutputs, @Nullable HistoricalTaskExecution previousExecution) {
for (Map.Entry<String, FileCollectionSnapshot> entry : taskOutputs.entrySet()) {
String propertyName = entry.getKey();
FileCollectionSnapshot beforeExecution = entry.getValue();
FileCollectionSnapshot afterPreviousExecution = getSnapshotAfterPreviousExecution(previousExecution, propertyName);
OverlappingOutputs overlappingOutputs = OverlappingOutputs.detect(propertyName, afterPreviousExecution, beforeExecution);
if (overlappingOutputs != null) {
return overlappingOutputs;
}
}
return null;
}
Aggregations