aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2015-12-07 10:32:26 +0000
committerGravatar David Chen <dzc@google.com>2015-12-07 21:17:56 +0000
commite9c41c5ad913be2e4fa19f95491a8177cd9dd6f2 (patch)
treeab671d0e50b17724306b7e7eadef7551b66fc218 /src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java
parentf815626bcd1e4ccdc2ff89e8a0ec754c2baa3b2d (diff)
RecursiveFilesystemTraversalFunction: introduce ResolvedFileFactoryForTesting.
Using this class it's easier to create ResolvedFile instances for tests that don't care about metadata eqality. -- MOS_MIGRATED_REVID=109562578
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java
index 9664fe7978..8c1ad8470c 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java
@@ -380,6 +380,11 @@ public final class RecursiveFilesystemTraversalValue implements SkyValue {
this.metadata = null;
}
+ private DanglingSymlink(RootedPath linkNamePath, PathFragment linkTargetPath) {
+ this.symlink = new Symlink(linkNamePath, linkTargetPath);
+ this.metadata = null;
+ }
+
DanglingSymlink(RootedPath linkNamePath, PathFragment linkTargetPath,
FileStateValue metadata) {
this.symlink = new Symlink(linkNamePath, linkTargetPath);
@@ -459,6 +464,13 @@ public final class RecursiveFilesystemTraversalValue implements SkyValue {
this.symlink = Preconditions.checkNotNull(symlink);
}
+ private SymlinkToFile(
+ RootedPath targetPath, RootedPath linkNamePath, PathFragment linkTargetPath) {
+ this.path = Preconditions.checkNotNull(targetPath);
+ this.metadata = null;
+ this.symlink = new Symlink(linkNamePath, linkTargetPath);
+ }
+
SymlinkToFile(RootedPath targetPath, RootedPath linkNamePath,
PathFragment linkTargetPath, FileStateValue metadata) {
this.path = Preconditions.checkNotNull(targetPath);
@@ -533,6 +545,13 @@ public final class RecursiveFilesystemTraversalValue implements SkyValue {
this.symlink = symlink;
}
+ private SymlinkToDirectory(
+ RootedPath targetPath, RootedPath linkNamePath, PathFragment linkValue) {
+ this.path = Preconditions.checkNotNull(targetPath);
+ this.metadata = null;
+ this.symlink = new Symlink(linkNamePath, linkValue);
+ }
+
SymlinkToDirectory(RootedPath targetPath, RootedPath linkNamePath,
PathFragment linkValue, FileStateValue metadata) {
this.path = Preconditions.checkNotNull(targetPath);
@@ -595,7 +614,7 @@ public final class RecursiveFilesystemTraversalValue implements SkyValue {
}
}
- public static final class ResolvedFileFactory {
+ static final class ResolvedFileFactory {
private ResolvedFileFactory() {}
public static ResolvedFile regularFile(RootedPath path, FileStateValue metadata) {
@@ -622,6 +641,30 @@ public final class RecursiveFilesystemTraversalValue implements SkyValue {
}
}
+ @VisibleForTesting
+ static final class ResolvedFileFactoryForTesting {
+ private ResolvedFileFactoryForTesting() {}
+
+ static ResolvedFile regularFileForTesting(RootedPath path) {
+ return new RegularFile(path);
+ }
+
+ static ResolvedFile symlinkToFileForTesting(
+ RootedPath targetPath, RootedPath linkNamePath, PathFragment linkTargetPath) {
+ return new SymlinkToFile(targetPath, linkNamePath, linkTargetPath);
+ }
+
+ static ResolvedFile symlinkToDirectoryForTesting(
+ RootedPath targetPath, RootedPath linkNamePath, PathFragment linkValue) {
+ return new SymlinkToDirectory(targetPath, linkNamePath, linkValue);
+ }
+
+ public static ResolvedFile danglingSymlinkForTesting(
+ RootedPath linkNamePath, PathFragment linkValue) {
+ return new DanglingSymlink(linkNamePath, linkValue);
+ }
+ }
+
/**
* Path and type information about a single file or symlink.
*