aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
index 40d6d4e1fe..949f09b168 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
@@ -121,7 +121,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
}
private Artifact getSourceArtifact(String path) throws Exception {
- return new Artifact(new PathFragment(path), Root.asSourceRoot(rootDirectory));
+ return new Artifact(PathFragment.create(path), Root.asSourceRoot(rootDirectory));
}
private Artifact createSourceArtifact(String path) throws Exception {
@@ -177,15 +177,15 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
}
private static FilesetOutputSymlink symlink(String from, Artifact to) {
- return new FilesetOutputSymlink(new PathFragment(from), to.getPath().asFragment());
+ return new FilesetOutputSymlink(PathFragment.create(from), to.getPath().asFragment());
}
private static FilesetOutputSymlink symlink(String from, String to) {
- return new FilesetOutputSymlink(new PathFragment(from), new PathFragment(to));
+ return new FilesetOutputSymlink(PathFragment.create(from), PathFragment.create(to));
}
private static FilesetOutputSymlink symlink(String from, RootedPath to) {
- return new FilesetOutputSymlink(new PathFragment(from), to.asPath().asFragment());
+ return new FilesetOutputSymlink(PathFragment.create(from), to.asPath().asFragment());
}
private void assertSymlinksInOrder(
@@ -215,7 +215,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//foo"),
/*fileToTraverse=*/ file,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
assertSymlinksInOrder(params, symlink("output-name", file));
@@ -224,13 +224,13 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
private void assertFileTraversalForFileSymlink(SymlinkBehavior symlinks) throws Exception {
Artifact file = createSourceArtifact("foo/file.real");
Artifact symlink = getSourceArtifact("foo/file.sym");
- symlink.getPath().createSymbolicLink(new PathFragment("file.real"));
+ symlink.getPath().createSymbolicLink(PathFragment.create("file.real"));
FilesetTraversalParams params =
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//foo"),
/*fileToTraverse=*/ symlink,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*symlinkBehaviorMode=*/ symlinks,
/*pkgBoundaryMode=*/ DONT_CROSS);
switch (symlinks) {
@@ -265,7 +265,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//foo"),
/*fileToTraverse=*/ dir,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
assertSymlinksInOrder(
@@ -277,13 +277,13 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
Artifact symlink = getSourceArtifact("foo/dir_sym");
createFile(childOf(dir, "file.a"), "hello");
createFile(childOf(dir, "sub/file.b"), "world");
- symlink.getPath().createSymbolicLink(new PathFragment("dir_real"));
+ symlink.getPath().createSymbolicLink(PathFragment.create("dir_real"));
FilesetTraversalParams params =
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//foo"),
/*fileToTraverse=*/ symlink,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*symlinkBehaviorMode=*/ symlinks,
/*pkgBoundaryMode=*/ DONT_CROSS);
switch (symlinks) {
@@ -316,7 +316,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
RootedPath buildFile = createFile(childOf(dir, "subpkg/BUILD"), "blah");
RootedPath fileB = createFile(childOf(dir, "subpkg/file.b"), "blah");
fileAsym.asPath().getParentDirectory().createDirectory();
- fileAsym.asPath().createSymbolicLink(new PathFragment("../file.a"));
+ fileAsym.asPath().createSymbolicLink(PathFragment.create("../file.a"));
FilesetOutputSymlink outA = symlink("output-name/file.a", childOf(dir, "file.a"));
FilesetOutputSymlink outAsym = null;
@@ -337,7 +337,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.recursiveTraversalOfDirectory(
/*ownerLabel=*/ label("//foo"),
/*directoryToTraverse=*/ dir,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*excludes=*/ null,
/*symlinkBehaviorMode=*/ symlinks,
/*pkgBoundaryMode=*/ pkgBoundaryMode);
@@ -399,8 +399,8 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
createFile(childOf(dir, "subpkg/BUILD"), "blah");
createFile(childOf(dir, "subpkg/file.b"), "blah");
fileAsym.asPath().getParentDirectory().createDirectory();
- fileAsym.asPath().createSymbolicLink(new PathFragment("../file.a"));
- symlink.getPath().createSymbolicLink(new PathFragment("dir_real"));
+ fileAsym.asPath().createSymbolicLink(PathFragment.create("../file.a"));
+ symlink.getPath().createSymbolicLink(PathFragment.create("dir_real"));
FilesetOutputSymlink outA = symlink("output-name/file.a", childOf(symlink, "file.a"));
FilesetOutputSymlink outASym = null;
@@ -423,7 +423,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.recursiveTraversalOfDirectory(
/*ownerLabel=*/ label("//foo"),
/*directoryToTraverse=*/ symlink,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*excludes=*/ null,
/*symlinkBehaviorMode=*/ symlinks,
/*pkgBoundaryMode=*/ pkgBoundaryMode);
@@ -488,8 +488,8 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
RootedPath fileB = createFile(siblingOf(subpkgBuildFile, "file.b"), "blah");
scratch.dir(fileAsym.asPath().getParentDirectory().getPathString());
- fileAsym.asPath().createSymbolicLink(new PathFragment("../file.a"));
- subpkgSymlink.getPath().createSymbolicLink(new PathFragment("subpkg"));
+ fileAsym.asPath().createSymbolicLink(PathFragment.create("../file.a"));
+ subpkgSymlink.getPath().createSymbolicLink(PathFragment.create("subpkg"));
FilesetOutputSymlink outBuild = symlink("output-name/BUILD", buildFile);
FilesetOutputSymlink outA = symlink("output-name/file.a", fileA);
@@ -514,7 +514,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.recursiveTraversalOfPackage(
/*ownerLabel=*/ label("//foo"),
/*directoryToTraverse=*/ buildFile,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*excludes=*/ null,
/*symlinkBehaviorMode=*/ symlinks,
/*pkgBoundaryMode=*/ pkgBoundaryMode);
@@ -576,14 +576,14 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//foo"),
/*fileToTraverse=*/ path,
- /*destPath=*/ new PathFragment("inner-out"),
+ PathFragment.create("inner-out"),
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
FilesetTraversalParams outer =
FilesetTraversalParamsFactory.nestedTraversal(
/*ownerLabel=*/ label("//foo:bar"),
/*nested=*/ inner,
- /*destDir=*/ new PathFragment("outer-out"),
+ PathFragment.create("outer-out"),
/*excludes=*/ null);
assertSymlinksInOrder(outer, symlink("outer-out/inner-out", rootedPath(path)));
}
@@ -598,7 +598,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.recursiveTraversalOfDirectory(
/*ownerLabel=*/ label("//foo"),
/*directoryToTraverse=*/ dir,
- /*destPath=*/ new PathFragment(useInnerDir ? "inner-dir" : ""),
+ PathFragment.create(useInnerDir ? "inner-dir" : ""),
/*excludes=*/ null,
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
@@ -606,7 +606,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.nestedTraversal(
/*ownerLabel=*/ label("//foo"),
/*nested=*/ inner,
- /*destDir=*/ new PathFragment("outer-dir"),
+ PathFragment.create("outer-dir"),
ImmutableSet.<String>of("file.a", "sub/file.c"));
if (useInnerDir) {
@@ -639,14 +639,14 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
public void testFileTraversalForDanglingSymlink() throws Exception {
Artifact linkName = getSourceArtifact("foo/dangling.sym");
RootedPath linkTarget = createFile(siblingOf(linkName, "target.file"), "blah");
- linkName.getPath().createSymbolicLink(new PathFragment("target.file"));
+ linkName.getPath().createSymbolicLink(PathFragment.create("target.file"));
linkTarget.asPath().delete();
FilesetTraversalParams params =
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//foo"),
/*fileToTraverse=*/ linkName,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
assertSymlinksInOrder(params); // expect empty results
@@ -659,14 +659,14 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
Artifact linkName = getSourceArtifact("foo/file.sym");
Artifact linkTarget = getSourceArtifact("foo/file.actual");
createFile(linkTarget);
- linkName.getPath().createSymbolicLink(new PathFragment("file.actual"));
+ linkName.getPath().createSymbolicLink(PathFragment.create("file.actual"));
// Ensure the symlink and its target would be included if they weren't explicitly excluded.
FilesetTraversalParams params =
FilesetTraversalParamsFactory.recursiveTraversalOfPackage(
/* ownerLabel */ label("//foo"),
/* buildFile */ buildFile,
- /* destPath */ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/* excludes */ ImmutableSet.<String>of(),
/* symlinkBehaviorMode */ symlinkBehavior,
/* pkgBoundaryMode */ PackageBoundaryMode.DONT_CROSS);
@@ -686,7 +686,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.recursiveTraversalOfPackage(
/* ownerLabel */ label("//foo"),
/* buildFile */ buildFile,
- /* destPath */ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/* excludes */ ImmutableSet.of("file.sym"),
/* symlinkBehaviorMode */ symlinkBehavior,
/* pkgBoundaryMode */ PackageBoundaryMode.DONT_CROSS);
@@ -710,7 +710,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//foo"),
/*fileToTraverse=*/ path,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
assertSymlinksInOrder(params); // expect empty results
@@ -720,14 +720,14 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
public void testRecursiveTraversalForDanglingSymlink() throws Exception {
Artifact linkName = getSourceArtifact("foo/dangling.sym");
RootedPath linkTarget = createFile(siblingOf(linkName, "target.file"), "blah");
- linkName.getPath().createSymbolicLink(new PathFragment("target.file"));
+ linkName.getPath().createSymbolicLink(PathFragment.create("target.file"));
linkTarget.asPath().delete();
FilesetTraversalParams params =
FilesetTraversalParamsFactory.recursiveTraversalOfDirectory(
/*ownerLabel=*/ label("//foo"),
/*directoryToTraverse=*/ linkName,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*excludes=*/ null,
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
@@ -742,7 +742,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.recursiveTraversalOfDirectory(
/*ownerLabel=*/ label("//foo"),
/*directoryToTraverse=*/ path,
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*excludes=*/ null,
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
@@ -853,7 +853,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
return FilesetTraversalParamsFactory.fileTraversal(
label((String) kwArgs.get("ownerLabel")),
getSourceArtifact((String) kwArgs.get("fileToTraverse")),
- new PathFragment((String) kwArgs.get("destPath")),
+ PathFragment.create((String) kwArgs.get("destPath")),
((SymlinkBehavior) kwArgs.get("symlinkBehaviorMode")),
(PackageBoundaryMode) kwArgs.get("pkgBoundaryMode"));
}
@@ -881,7 +881,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
return FilesetTraversalParamsFactory.recursiveTraversalOfDirectory(
label((String) kwArgs.get("ownerLabel")),
getSourceArtifact((String) kwArgs.get("directoryToTraverse")),
- new PathFragment((String) kwArgs.get("destPath")),
+ PathFragment.create((String) kwArgs.get("destPath")),
(Set<String>) kwArgs.get("excludes"),
((SymlinkBehavior) kwArgs.get("symlinkBehaviorMode")),
(PackageBoundaryMode) kwArgs.get("pkgBoundaryMode"));
@@ -910,7 +910,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
return FilesetTraversalParamsFactory.recursiveTraversalOfPackage(
label((String) kwArgs.get("ownerLabel")),
getSourceArtifact((String) kwArgs.get("buildFile")),
- new PathFragment((String) kwArgs.get("destPath")),
+ PathFragment.create((String) kwArgs.get("destPath")),
(Set<String>) kwArgs.get("excludes"),
((SymlinkBehavior) kwArgs.get("symlinkBehaviorMode")),
(PackageBoundaryMode) kwArgs.get("pkgBoundaryMode"));
@@ -924,7 +924,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//blah"),
/*fileToTraverse=*/ getSourceArtifact("blah/file.a"),
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
@@ -932,7 +932,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
FilesetTraversalParamsFactory.fileTraversal(
/*ownerLabel=*/ label("//blah"),
/*fileToTraverse=*/ getSourceArtifact("meow/file.b"),
- /*destPath=*/ new PathFragment("output-name"),
+ PathFragment.create("output-name"),
/*symlinkBehaviorMode=*/ SymlinkBehavior.COPY,
/*pkgBoundaryMode=*/ DONT_CROSS);
@@ -949,7 +949,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
return FilesetTraversalParamsFactory.nestedTraversal(
label((String) kwArgs.get("ownerLabel")),
(FilesetTraversalParams) kwArgs.get("nested"),
- new PathFragment((String) kwArgs.get("destDir")),
+ PathFragment.create((String) kwArgs.get("destDir")),
(Set<String>) kwArgs.get("excludes"));
}
}.doTest();