use of org.gradle.api.internal.changedetection.state.FileCollectionSnapshot in project gradle by gradle.
the class DefaultClasspathHasher method hash.
@Override
public HashCode hash(ClassPath classpath) {
FileCollectionSnapshot snapshot = snapshotter.snapshot(new SimpleFileCollection(classpath.getAsFiles()), null, InputNormalizationStrategy.NOT_CONFIGURED);
BuildCacheHasher hasher = new DefaultBuildCacheHasher();
snapshot.appendToHasher(hasher);
return hasher.hash();
}
use of org.gradle.api.internal.changedetection.state.FileCollectionSnapshot in project gradle by gradle.
the class TaskCacheKeyCalculator method calculate.
public TaskOutputCachingBuildCacheKey calculate(TaskInternal task, TaskExecution execution) {
TaskOutputCachingBuildCacheKeyBuilder builder = new DefaultTaskOutputCachingBuildCacheKeyBuilder(task.getIdentityPath());
if (buildCacheDebugLogging) {
builder = new DebuggingTaskOutputCachingBuildCacheKeyBuilder(builder);
}
builder.appendTaskImplementation(execution.getTaskImplementation());
builder.appendTaskActionImplementations(execution.getTaskActionImplementations());
SortedMap<String, ValueSnapshot> inputProperties = execution.getInputProperties();
for (Map.Entry<String, ValueSnapshot> entry : inputProperties.entrySet()) {
DefaultBuildCacheHasher newHasher = new DefaultBuildCacheHasher();
entry.getValue().appendToHasher(newHasher);
if (newHasher.isValid()) {
HashCode hash = newHasher.hash();
builder.appendInputPropertyHash(entry.getKey(), hash);
} else {
builder.inputPropertyLoadedByUnknownClassLoader(entry.getKey());
}
}
SortedMap<String, FileCollectionSnapshot> inputFilesSnapshots = execution.getInputFilesSnapshot();
for (Map.Entry<String, FileCollectionSnapshot> entry : inputFilesSnapshots.entrySet()) {
FileCollectionSnapshot snapshot = entry.getValue();
builder.appendInputPropertyHash(entry.getKey(), snapshot.getHash());
}
SortedSet<String> outputPropertyNamesForCacheKey = execution.getOutputPropertyNamesForCacheKey();
for (String cacheableOutputPropertyName : outputPropertyNamesForCacheKey) {
builder.appendOutputPropertyName(cacheableOutputPropertyName);
}
return builder.build();
}
Aggregations