use of org.gradle.internal.snapshot.FileSystemLocationSnapshot.FileSystemLocationSnapshotVisitor in project gradle by gradle.
the class IgnoredPathFingerprintingStrategy method collectFingerprints.
@Override
public Map<String, FileSystemLocationFingerprint> collectFingerprints(FileSystemSnapshot roots) {
ImmutableMap.Builder<String, FileSystemLocationFingerprint> builder = ImmutableMap.builder();
HashSet<String> processedEntries = new HashSet<>();
roots.accept(snapshot -> {
snapshot.accept(new FileSystemLocationSnapshotVisitor() {
@Override
public void visitRegularFile(RegularFileSnapshot fileSnapshot) {
visitNonDirectoryEntry(snapshot);
}
@Override
public void visitMissing(MissingFileSnapshot missingSnapshot) {
visitNonDirectoryEntry(snapshot);
}
private void visitNonDirectoryEntry(FileSystemLocationSnapshot snapshot) {
String absolutePath = snapshot.getAbsolutePath();
if (processedEntries.add(absolutePath)) {
HashCode normalizedContentHash = getNormalizedContentHash(snapshot, normalizedContentHasher);
if (normalizedContentHash != null) {
builder.put(absolutePath, IgnoredPathFileSystemLocationFingerprint.create(snapshot.getType(), normalizedContentHash));
}
}
}
});
return SnapshotVisitResult.CONTINUE;
});
return builder.build();
}
Aggregations