Skip to content

Commit

Permalink
Rename FileSystemSnapshotVisitor to FileSystemSnapshotHierarchyVisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
lptr committed Oct 30, 2020
1 parent 376933a commit bc2130e
Show file tree
Hide file tree
Showing 32 changed files with 62 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;
import org.gradle.internal.snapshot.MerkleDirectorySnapshotBuilder;
import org.gradle.internal.snapshot.RegularFileSnapshot;
import org.gradle.internal.snapshot.RelativePathStringTracker;
Expand Down Expand Up @@ -329,7 +329,7 @@ private static String unescape(String name) {
}
}

private static class PackingVisitor implements FileSystemSnapshotVisitor {
private static class PackingVisitor implements FileSystemSnapshotHierarchyVisitor {
private final RelativePathStringTracker relativePathStringTracker;
private final TarArchiveOutputStream tarOutput;
private final String treePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.gradle.internal.operations.trace.CustomOperationTraceSerialization;
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;
import org.gradle.internal.snapshot.impl.ImplementationSnapshot;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -88,7 +88,7 @@ public byte[] apply(HashCode input) {
}

@NonNullApi
private static class State implements VisitState, FileSystemSnapshotVisitor {
private static class State implements VisitState, FileSystemSnapshotHierarchyVisitor {

final InputFilePropertyVisitor visitor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import org.gradle.internal.Factory
import org.gradle.internal.snapshot.CompleteDirectorySnapshot
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot
import org.gradle.internal.snapshot.FileSystemSnapshot
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor
import org.gradle.test.fixtures.file.TestFile
import org.gradle.test.fixtures.file.TestNameTestDirectoryProvider
import org.junit.Rule
Expand Down Expand Up @@ -234,7 +234,7 @@ class DefaultFileCollectionSnapshotterTest extends Specification {
private static List getSnapshotInfo(FileSystemSnapshot tree) {
String rootPath = null
int count = 0
tree.accept(new FileSystemSnapshotVisitor() {
tree.accept(new FileSystemSnapshotHierarchyVisitor() {
@Override
boolean preVisitDirectory(CompleteDirectorySnapshot directorySnapshot) {
if (rootPath == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.gradle.internal.hash.HashCode
import org.gradle.internal.snapshot.CompleteDirectorySnapshot
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot
import org.gradle.internal.snapshot.FileSystemSnapshot
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor
import org.gradle.internal.snapshot.RegularFileSnapshot
import org.gradle.internal.snapshot.RelativePathSegmentsTracker
import org.gradle.test.fixtures.file.CleanupTestDirectory
Expand Down Expand Up @@ -66,7 +66,7 @@ class FileSystemSnapshotBuilderTest extends Specification {
Set<String> files = [] as Set
Set<String> relativePaths = [] as Set
def result = builder.build()
result.accept(new FileSystemSnapshotVisitor() {
result.accept(new FileSystemSnapshotHierarchyVisitor() {
private final relativePathTracker = new RelativePathSegmentsTracker()

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;

import java.io.Closeable;
import java.io.File;
Expand Down Expand Up @@ -65,7 +65,7 @@ private boolean containsFilesGeneratedByGradle(File absoluteFile) {
@Override
public void recordOutputs(Iterable<? extends FileSystemSnapshot> outputFileFingerprints) {
for (FileSystemSnapshot outputFileFingerprint : outputFileFingerprints) {
outputFileFingerprint.accept(new FileSystemSnapshotVisitor() {
outputFileFingerprint.accept(new FileSystemSnapshotHierarchyVisitor() {
@Override
public boolean preVisitDirectory(CompleteDirectorySnapshot directorySnapshot) {
recordOutputSnapshot(directorySnapshot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;
import org.gradle.internal.snapshot.MerkleDirectorySnapshotBuilder;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -109,7 +109,7 @@ private static boolean isOutputEntry(Map<String, FileSystemLocationFingerprint>
return afterPreviousExecutionFingerprints.containsKey(afterExecutionSnapshot.getAbsolutePath());
}

private static class GetAllSnapshotsVisitor implements FileSystemSnapshotVisitor {
private static class GetAllSnapshotsVisitor implements FileSystemSnapshotHierarchyVisitor {
private final Map<String, CompleteFileSystemLocationSnapshot> snapshots = new HashMap<>();

@Override
Expand All @@ -132,7 +132,7 @@ public Map<String, CompleteFileSystemLocationSnapshot> getSnapshots() {
}
}

private static class SnapshotFilteringVisitor implements FileSystemSnapshotVisitor {
private static class SnapshotFilteringVisitor implements FileSystemSnapshotHierarchyVisitor {
private final BiPredicate<CompleteFileSystemLocationSnapshot, Boolean> predicate;
private final ImmutableList.Builder<FileSystemSnapshot> newRootsBuilder = ImmutableList.builder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.gradle.internal.fingerprint.impl.DefaultCurrentFileCollectionFingerpr
import org.gradle.internal.snapshot.CompleteDirectorySnapshot
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot
import org.gradle.internal.snapshot.FileSystemSnapshot
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor
import org.gradle.test.fixtures.file.TestNameTestDirectoryProvider
import org.junit.Rule
import spock.lang.Specification
Expand Down Expand Up @@ -178,7 +178,7 @@ class OutputFilterUtilTest extends Specification {
List<File> collectFiles(ImmutableList<FileSystemSnapshot> fileSystemSnapshots) {
def result = []
fileSystemSnapshots.each {
it.accept(new FileSystemSnapshotVisitor() {
it.accept(new FileSystemSnapshotHierarchyVisitor() {
@Override
boolean preVisitDirectory(CompleteDirectorySnapshot directorySnapshot) {
result.add(directorySnapshot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ChangesDuringTheBuildFileSystemWatchingIntegrationTest extends AbstractFil
def vfs = gradle.services.get(VirtualFileSystem)
int filesInVfs = 0
vfs.rootReference.getRoot().visitSnapshotRoots { snapshot ->
snapshot.accept(new FileSystemSnapshotVisitor() {
snapshot.accept(new FileSystemSnapshotHierarchyVisitor() {
@Override
void visitFile(CompleteFileSystemLocationSnapshot fileSnapshot) {
if (fileSnapshot.type == FileType.RegularFile && fileSnapshot.absolutePath.startsWith(projectRoot)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import net.rubygrapefruit.platform.file.FileWatcher;
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;
import org.gradle.internal.snapshot.SnapshotHierarchy;
import org.gradle.internal.watch.WatchingNotSupportedException;
import org.gradle.internal.watch.registry.FileWatcherUpdater;
Expand Down Expand Up @@ -165,7 +165,7 @@ private static void increment(String path, Map<String, Integer> changedWatchedDi
changedWatchedDirectories.compute(path, (key, value) -> value == null ? 1 : value + 1);
}

private class SubdirectoriesToWatchVisitor implements FileSystemSnapshotVisitor {
private class SubdirectoriesToWatchVisitor implements FileSystemSnapshotHierarchyVisitor {
private final Consumer<String> subDirectoryToWatchConsumer;
private boolean root;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.gradle.internal.file.FileMetadata;
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;
import org.gradle.internal.snapshot.SnapshotHierarchy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -121,7 +121,7 @@ public boolean shouldWatch(CompleteFileSystemLocationSnapshot snapshot) {
return !ignoredForWatching(snapshot) && isInWatchableHierarchy(snapshot.getAbsolutePath());
}

private class RemoveUnwatchedFiles implements FileSystemSnapshotVisitor {
private class RemoveUnwatchedFiles implements FileSystemSnapshotHierarchyVisitor {
private SnapshotHierarchy root;
private final Invalidator invalidator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.gradle.internal.file.FileType;
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;
import org.gradle.internal.snapshot.SnapshotHierarchy;
import org.gradle.internal.watch.registry.FileWatcherRegistry;
import org.gradle.internal.watch.vfs.FileSystemWatchingStatistics;
Expand Down Expand Up @@ -65,7 +65,7 @@ public int getRetainedMissingFiles() {

private static VirtualFileSystemStatistics getStatistics(SnapshotHierarchy root) {
EnumMultiset<FileType> retained = EnumMultiset.create(FileType.class);
root.visitSnapshotRoots(snapshot -> snapshot.accept(new FileSystemSnapshotVisitor() {
root.visitSnapshotRoots(snapshot -> snapshot.accept(new FileSystemSnapshotHierarchyVisitor() {
@Override
public boolean preVisitDirectory(CompleteDirectorySnapshot directorySnapshot) {
retained.add(directorySnapshot.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import org.gradle.api.internal.changedetection.state.DefaultRegularFileSnapshotContext;
import org.gradle.api.internal.changedetection.state.IgnoringResourceHasher;
import org.gradle.api.internal.changedetection.state.ManifestFileZipEntryHasher;
import org.gradle.api.internal.changedetection.state.RegularFileSnapshotContext;
import org.gradle.api.internal.changedetection.state.MetaInfAwareClasspathResourceHasher;
import org.gradle.api.internal.changedetection.state.PropertiesFileAwareClasspathResourceHasher;
import org.gradle.api.internal.changedetection.state.RegularFileSnapshotContext;
import org.gradle.api.internal.changedetection.state.ResourceEntryFilter;
import org.gradle.api.internal.changedetection.state.ResourceFilter;
import org.gradle.api.internal.changedetection.state.ResourceHasher;
import org.gradle.api.internal.changedetection.state.ResourceSnapshotterCacheService;
import org.gradle.api.internal.changedetection.state.RuntimeClasspathResourceHasher;
import org.gradle.api.internal.changedetection.state.MetaInfAwareClasspathResourceHasher;
import org.gradle.api.internal.changedetection.state.ZipHasher;
import org.gradle.internal.file.FileType;
import org.gradle.internal.fingerprint.FileSystemLocationFingerprint;
Expand All @@ -43,7 +43,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;
import org.gradle.internal.snapshot.RegularFileSnapshot;
import org.gradle.internal.snapshot.RelativePathSegmentsTracker;
import org.gradle.internal.snapshot.RelativePathStringTracker;
Expand Down Expand Up @@ -146,7 +146,7 @@ public HashCode determineNonJarFingerprint(HashCode original) {
public abstract HashCode determineNonJarFingerprint(HashCode original);
}

private class ClasspathContentFingerprintingVisitor implements FileSystemSnapshotVisitor {
private class ClasspathContentFingerprintingVisitor implements FileSystemSnapshotHierarchyVisitor {
private final ClasspathFingerprintVisitor delegate;
private final RelativePathSegmentsTracker relativePathSegmentsTracker = new RelativePathSegmentsTracker();
public ClasspathContentFingerprintingVisitor(ClasspathFingerprintVisitor delegate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;

import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -54,7 +54,7 @@ public Map<String, FileSystemLocationFingerprint> collectFingerprints(Iterable<?
final ImmutableMap.Builder<String, FileSystemLocationFingerprint> builder = ImmutableMap.builder();
final HashSet<String> processedEntries = new HashSet<String>();
for (FileSystemSnapshot root : roots) {
root.accept(new FileSystemSnapshotVisitor() {
root.accept(new FileSystemSnapshotHierarchyVisitor() {
private int treeDepth = 0;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;

import java.util.Map;

Expand Down Expand Up @@ -59,7 +59,7 @@ private DefaultCurrentFileCollectionFingerprint(Map<String, FileSystemLocationFi
this.roots = roots;

final ImmutableMultimap.Builder<String, HashCode> builder = ImmutableMultimap.builder();
accept(new FileSystemSnapshotVisitor() {
accept(new FileSystemSnapshotHierarchyVisitor() {
@Override
public boolean preVisitDirectory(CompleteDirectorySnapshot directorySnapshot) {
builder.put(directorySnapshot.getAbsolutePath(), directorySnapshot.getHash());
Expand Down Expand Up @@ -110,7 +110,7 @@ public String getStrategyIdentifier() {
}

@Override
public void accept(FileSystemSnapshotVisitor visitor) {
public void accept(FileSystemSnapshotHierarchyVisitor visitor) {
if (roots == null) {
throw new UnsupportedOperationException("Roots not available.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.gradle.internal.fingerprint.FileSystemLocationFingerprint;
import org.gradle.internal.hash.HashCode;
import org.gradle.internal.hash.Hashing;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;

import java.util.Collections;
import java.util.Map;
Expand Down Expand Up @@ -53,7 +53,7 @@ public Map<String, FileSystemLocationFingerprint> getFingerprints() {
}

@Override
public void accept(FileSystemSnapshotVisitor visitor) {
public void accept(FileSystemSnapshotHierarchyVisitor visitor) {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;

import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -52,7 +52,7 @@ public Map<String, FileSystemLocationFingerprint> collectFingerprints(Iterable<?
final ImmutableMap.Builder<String, FileSystemLocationFingerprint> builder = ImmutableMap.builder();
final HashSet<String> processedEntries = new HashSet<String>();
for (FileSystemSnapshot root : roots) {
root.accept(new FileSystemSnapshotVisitor() {
root.accept(new FileSystemSnapshotHierarchyVisitor() {

@Override
public boolean preVisitDirectory(CompleteDirectorySnapshot directorySnapshot) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;

import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -51,7 +51,7 @@ public Map<String, FileSystemLocationFingerprint> collectFingerprints(Iterable<?
final ImmutableMap.Builder<String, FileSystemLocationFingerprint> builder = ImmutableMap.builder();
final HashSet<String> processedEntries = new HashSet<String>();
for (FileSystemSnapshot root : roots) {
root.accept(new FileSystemSnapshotVisitor() {
root.accept(new FileSystemSnapshotHierarchyVisitor() {
private boolean root = true;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;
import org.gradle.internal.snapshot.RelativePathStringTracker;

import java.util.HashSet;
Expand Down Expand Up @@ -59,7 +59,7 @@ public Map<String, FileSystemLocationFingerprint> collectFingerprints(Iterable<?
final ImmutableMap.Builder<String, FileSystemLocationFingerprint> builder = ImmutableMap.builder();
final HashSet<String> processedEntries = new HashSet<String>();
for (FileSystemSnapshot root : roots) {
root.accept(new FileSystemSnapshotVisitor() {
root.accept(new FileSystemSnapshotHierarchyVisitor() {
private final RelativePathStringTracker relativePathStringTracker = new RelativePathStringTracker();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.gradle.internal.snapshot.CompleteDirectorySnapshot;
import org.gradle.internal.snapshot.CompleteFileSystemLocationSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshot;
import org.gradle.internal.snapshot.FileSystemSnapshotVisitor;
import org.gradle.internal.snapshot.FileSystemSnapshotHierarchyVisitor;

import javax.annotation.Nullable;
import java.util.Map;
Expand Down Expand Up @@ -76,7 +76,7 @@ private static boolean createdSincePreviousExecution(@Nullable HashCode previous
return previousContentHash == null;
}

private static class OverlappingOutputsDetectingVisitor implements FileSystemSnapshotVisitor {
private static class OverlappingOutputsDetectingVisitor implements FileSystemSnapshotHierarchyVisitor {
private final Map<String, FileSystemLocationFingerprint> previousFingerprints;
private int treeDepth = 0;
private String overlappingPath;
Expand Down
Loading

0 comments on commit bc2130e

Please sign in to comment.