use of com.google.devtools.build.lib.vfs.PathFragment in project bazel by bazelbuild.
the class TreeArtifactMetadataTest method createTreeArtifact.
private Artifact createTreeArtifact(String path) throws IOException {
PathFragment execPath = new PathFragment("out").getRelative(path);
Path fullPath = root.getRelative(execPath);
Artifact output = new SpecialArtifact(fullPath, Root.asDerivedRoot(root, root.getRelative("out")), execPath, ALL_OWNER, SpecialArtifactType.TREE);
actions.add(new DummyAction(ImmutableList.<Artifact>of(), output));
FileSystemUtils.createDirectoryAndParents(fullPath);
return output;
}
use of com.google.devtools.build.lib.vfs.PathFragment in project bazel by bazelbuild.
the class PrepareDepsOfPatternsFunctionSmartNegationTest method testBlacklistPatternBlocksPatternEvaluation.
@Test
public void testBlacklistPatternBlocksPatternEvaluation() throws Exception {
// Given a well-formed package "//foo" and a malformed package "//foo/foo",
createFooAndFooFoo();
// Given a target pattern sequence consisting of a recursive pattern for "//foo/...",
ImmutableList<String> patternSequence = ImmutableList.of("//foo/...");
// and a blacklist for the malformed package,
getSkyframeExecutor().setBlacklistedPackagePrefixesFile(new PathFragment("config/blacklist.txt"));
scratch.file("config/blacklist.txt", "foo/foo");
assertSkipsFoo(patternSequence);
}
use of com.google.devtools.build.lib.vfs.PathFragment in project bazel by bazelbuild.
the class RecursiveFilesystemTraversalFunctionTest method derivedArtifact.
private Artifact derivedArtifact(String path) {
PathFragment execPath = new PathFragment("out").getRelative(path);
Path fullPath = rootDirectory.getRelative(execPath);
Artifact output = new Artifact(fullPath, Root.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out")), execPath);
return output;
}
use of com.google.devtools.build.lib.vfs.PathFragment in project bazel by bazelbuild.
the class RecursiveFilesystemTraversalFunctionTest method testTraversalOfTransitiveSymlinkToFile.
@Test
public void testTraversalOfTransitiveSymlinkToFile() throws Exception {
Artifact directLinkArtifact = sourceArtifact("direct/file.sym");
Artifact transitiveLinkArtifact = sourceArtifact("transitive/sym.sym");
RootedPath fileA = createFile(rootedPath(sourceArtifact("a/file.a")));
RootedPath directLink = rootedPath(directLinkArtifact);
RootedPath transitiveLink = rootedPath(transitiveLinkArtifact);
PathFragment directLinkPath = new PathFragment("../a/file.a");
PathFragment transitiveLinkPath = new PathFragment("../direct/file.sym");
parentOf(directLink).asPath().createDirectory();
parentOf(transitiveLink).asPath().createDirectory();
directLink.asPath().createSymbolicLink(directLinkPath);
transitiveLink.asPath().createSymbolicLink(transitiveLinkPath);
traverseAndAssertFiles(fileLikeRoot(directLinkArtifact, DONT_CROSS), symlinkToFileForTesting(fileA, directLink, directLinkPath));
traverseAndAssertFiles(fileLikeRoot(transitiveLinkArtifact, DONT_CROSS), symlinkToFileForTesting(fileA, transitiveLink, transitiveLinkPath));
}
use of com.google.devtools.build.lib.vfs.PathFragment in project bazel by bazelbuild.
the class RecursiveFilesystemTraversalFunctionTest method testTraversalOfTransitiveSymlinkToDirectory.
@Test
public void testTraversalOfTransitiveSymlinkToDirectory() throws Exception {
Artifact directLinkArtifact = sourceArtifact("direct/dir.sym");
Artifact transitiveLinkArtifact = sourceArtifact("transitive/sym.sym");
RootedPath fileA = createFile(rootedPath(sourceArtifact("a/file.a")));
RootedPath directLink = rootedPath(directLinkArtifact);
RootedPath transitiveLink = rootedPath(transitiveLinkArtifact);
PathFragment directLinkPath = new PathFragment("../a");
PathFragment transitiveLinkPath = new PathFragment("../direct/dir.sym");
parentOf(directLink).asPath().createDirectory();
parentOf(transitiveLink).asPath().createDirectory();
directLink.asPath().createSymbolicLink(directLinkPath);
transitiveLink.asPath().createSymbolicLink(transitiveLinkPath);
// Expect the file as if was a child of the direct symlink, not of the actual directory.
traverseAndAssertFiles(fileLikeRoot(directLinkArtifact, DONT_CROSS), symlinkToDirectoryForTesting(parentOf(fileA), directLink, directLinkPath), regularFileForTesting(childOf(directLinkArtifact, "file.a")));
// Expect the file as if was a child of the transitive symlink, not of the actual directory.
traverseAndAssertFiles(fileLikeRoot(transitiveLinkArtifact, DONT_CROSS), symlinkToDirectoryForTesting(parentOf(fileA), transitiveLink, transitiveLinkPath), regularFileForTesting(childOf(transitiveLinkArtifact, "file.a")));
}
Aggregations