use of org.gradle.internal.snapshot.RelativePathTracker in project gradle by gradle.
the class TarBuildCacheEntryPacker method packTree.
private long packTree(String name, TreeType type, FileSystemSnapshot snapshots, TarArchiveOutputStream tarOutput) {
PackingVisitor packingVisitor = new PackingVisitor(tarOutput, name, type, filePermissionAccess);
snapshots.accept(new RelativePathTracker(), packingVisitor);
return packingVisitor.getPackedEntryCount();
}
use of org.gradle.internal.snapshot.RelativePathTracker in project gradle by gradle.
the class RelativePathFingerprintingStrategy method collectFingerprints.
@Override
public Map<String, FileSystemLocationFingerprint> collectFingerprints(FileSystemSnapshot roots) {
ImmutableMap.Builder<String, FileSystemLocationFingerprint> builder = ImmutableMap.builder();
HashSet<String> processedEntries = new HashSet<>();
roots.accept(new RelativePathTracker(), (snapshot, relativePath) -> {
String absolutePath = snapshot.getAbsolutePath();
if (processedEntries.add(absolutePath) && getDirectorySensitivity().shouldFingerprint(snapshot)) {
FileSystemLocationFingerprint fingerprint;
if (relativePath.isRoot()) {
if (snapshot.getType() == FileType.Directory) {
return SnapshotVisitResult.CONTINUE;
} else {
fingerprint = fingerprint(snapshot.getName(), snapshot.getType(), snapshot);
}
} else {
fingerprint = fingerprint(stringInterner.intern(relativePath.toRelativePath()), snapshot.getType(), snapshot);
}
if (fingerprint != null) {
builder.put(absolutePath, fingerprint);
}
}
return SnapshotVisitResult.CONTINUE;
});
return builder.build();
}
use of org.gradle.internal.snapshot.RelativePathTracker in project gradle by gradle.
the class FileSystemSnapshotFilter method filterSnapshot.
public static FileSystemSnapshot filterSnapshot(SnapshottingFilter.FileSystemSnapshotPredicate predicate, FileSystemSnapshot unfiltered) {
DirectorySnapshotBuilder builder = MerkleDirectorySnapshotBuilder.noSortingRequired();
AtomicBoolean hasBeenFiltered = new AtomicBoolean(false);
unfiltered.accept(new RelativePathTracker(), new FilteringVisitor(predicate, builder, hasBeenFiltered));
if (builder.getResult() == null) {
return FileSystemSnapshot.EMPTY;
}
return hasBeenFiltered.get() ? builder.getResult() : unfiltered;
}
use of org.gradle.internal.snapshot.RelativePathTracker in project gradle by gradle.
the class ClasspathFingerprintingStrategy method collectFingerprints.
@Override
public Map<String, FileSystemLocationFingerprint> collectFingerprints(FileSystemSnapshot roots) {
ImmutableMap.Builder<String, FileSystemLocationFingerprint> builder = ImmutableMap.builder();
HashSet<String> processedEntries = new HashSet<>();
roots.accept(new RelativePathTracker(), new ClasspathFingerprintingVisitor(processedEntries, builder));
return builder.build();
}
Aggregations