use of com.google.devtools.build.lib.vfs.Path in project bazel by bazelbuild.
the class SdkMavenRepositoryTest method testBuildFilesWritten.
@Test
public void testBuildFilesWritten() throws Exception {
sdkMavenRepository.writeBuildFiles(workspaceDir);
Path groupIdPath = scratch.resolve("com.google.android");
assertThat(workspaceDir.getDirectoryEntries()).containsAllOf(repoPath, groupIdPath);
Path buildFilePath = groupIdPath.getRelative("BUILD");
assertThat(groupIdPath.getDirectoryEntries()).containsExactly(buildFilePath);
}
use of com.google.devtools.build.lib.vfs.Path in project bazel by bazelbuild.
the class SymlinkForestTest method testRemotePackage.
@Test
public void testRemotePackage() throws Exception {
Path outputBase = fileSystem.getPath("/ob");
Path rootY = outputBase.getRelative(Label.EXTERNAL_PATH_PREFIX).getRelative("y");
Path rootZ = outputBase.getRelative(Label.EXTERNAL_PATH_PREFIX).getRelative("z");
Path rootW = outputBase.getRelative(Label.EXTERNAL_PATH_PREFIX).getRelative("w");
createDirectoryAndParents(rootY);
FileSystemUtils.createEmptyFile(rootY.getRelative("file"));
ImmutableMap<PackageIdentifier, Path> packageRootMap = ImmutableMap.<PackageIdentifier, Path>builder().put(createPkg(outputBase, "y", "w"), outputBase).put(createPkg(outputBase, "z", ""), outputBase).put(createPkg(outputBase, "z", "a/b/c"), outputBase).put(createPkg(outputBase, "w", ""), outputBase).build();
new SymlinkForest(packageRootMap, linkRoot, TestConstants.PRODUCT_NAME, "wsname").plantSymlinkForest();
assertFalse(linkRoot.getRelative(Label.EXTERNAL_PATH_PREFIX + "/y/file").exists());
assertLinksTo(linkRoot.getRelative(Label.EXTERNAL_PATH_PREFIX + "/y/w"), rootY.getRelative("w"));
assertLinksTo(linkRoot.getRelative(Label.EXTERNAL_PATH_PREFIX + "/z/file"), rootZ.getRelative("file"));
assertLinksTo(linkRoot.getRelative(Label.EXTERNAL_PATH_PREFIX + "/z/a"), rootZ.getRelative("a"));
assertLinksTo(linkRoot.getRelative(Label.EXTERNAL_PATH_PREFIX + "/w/file"), rootW.getRelative("file"));
}
use of com.google.devtools.build.lib.vfs.Path in project bazel by bazelbuild.
the class SymlinkForestTest method testExternalPackage.
@Test
public void testExternalPackage() throws Exception {
Path root = fileSystem.getPath("/src");
ImmutableMap<PackageIdentifier, Path> packageRootMap = ImmutableMap.<PackageIdentifier, Path>builder().put(Label.EXTERNAL_PACKAGE_IDENTIFIER, root).build();
new SymlinkForest(packageRootMap, linkRoot, TestConstants.PRODUCT_NAME, "wsname").plantSymlinkForest();
assertThat(linkRoot.getRelative(Label.EXTERNAL_PATH_PREFIX).exists()).isFalse();
}
use of com.google.devtools.build.lib.vfs.Path in project bazel by bazelbuild.
the class SymlinkForestTest method testWorkspaceName.
@Test
public void testWorkspaceName() throws Exception {
Path root = fileSystem.getPath("/src");
ImmutableMap<PackageIdentifier, Path> packageRootMap = ImmutableMap.<PackageIdentifier, Path>builder().put(createPkg(root, "y", "w"), root).build();
new SymlinkForest(packageRootMap, linkRoot, TestConstants.PRODUCT_NAME, "wsname").plantSymlinkForest();
assertThat(linkRoot.getRelative("../wsname").exists()).isTrue();
}
use of com.google.devtools.build.lib.vfs.Path in project bazel by bazelbuild.
the class SymlinkForestTest method testPlantLinkForest.
@Test
public void testPlantLinkForest() throws IOException {
Path rootA = fileSystem.getPath("/A");
Path rootB = fileSystem.getPath("/B");
ImmutableMap<PackageIdentifier, Path> packageRootMap = ImmutableMap.<PackageIdentifier, Path>builder().put(createPkg(rootA, rootB, "pkgA"), rootA).put(createPkg(rootA, rootB, "dir1/pkgA"), rootA).put(createPkg(rootA, rootB, "dir1/pkgB"), rootB).put(createPkg(rootA, rootB, "dir2/pkg"), rootA).put(createPkg(rootA, rootB, "dir2/pkg/pkg"), rootB).put(createPkg(rootA, rootB, "pkgB"), rootB).put(createPkg(rootA, rootB, "pkgB/dir/pkg"), rootA).put(createPkg(rootA, rootB, "pkgB/pkg"), rootA).put(createPkg(rootA, rootB, "pkgB/pkg/pkg"), rootA).build();
// create a file in there
createPkg(rootA, rootB, "pkgB/dir");
Path linkRoot = fileSystem.getPath("/linkRoot");
createDirectoryAndParents(linkRoot);
new SymlinkForest(packageRootMap, linkRoot, TestConstants.PRODUCT_NAME, "wsname").plantSymlinkForest();
assertLinksTo(linkRoot, rootA, "pkgA");
assertIsDir(linkRoot, "dir1");
assertLinksTo(linkRoot, rootA, "dir1/pkgA");
assertLinksTo(linkRoot, rootB, "dir1/pkgB");
assertIsDir(linkRoot, "dir2");
assertIsDir(linkRoot, "dir2/pkg");
assertLinksTo(linkRoot, rootA, "dir2/pkg/file");
assertLinksTo(linkRoot, rootB, "dir2/pkg/pkg");
assertIsDir(linkRoot, "pkgB");
assertIsDir(linkRoot, "pkgB/dir");
assertLinksTo(linkRoot, rootB, "pkgB/dir/file");
assertLinksTo(linkRoot, rootA, "pkgB/dir/pkg");
assertLinksTo(linkRoot, rootA, "pkgB/pkg");
}
Aggregations