use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ImportRootsTest method testBazelArtifactDirectoriesExcluded.
@Test
public void testBazelArtifactDirectoriesExcluded() {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Bazel).add(new DirectoryEntry(new WorkspacePath(""), true)).build();
ImmutableList<String> artifactDirs = BuildSystemProvider.getBuildSystemProvider(BuildSystem.Bazel).buildArtifactDirectories(workspaceRoot);
assertThat(importRoots.rootDirectories()).containsExactly(new WorkspacePath(""));
assertThat(importRoots.excludeDirectories().stream().map(WorkspacePath::relativePath).collect(Collectors.toList())).containsExactlyElementsIn(artifactDirs);
assertThat(artifactDirs).contains("bazel-" + workspaceRoot.directory().getName());
}
use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ImportRootsTest method testNoAddedExclusionsForBlaze.
@Test
public void testNoAddedExclusionsForBlaze() {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Blaze).add(new DirectoryEntry(new WorkspacePath(""), true)).build();
assertThat(importRoots.rootDirectories()).containsExactly(new WorkspacePath(""));
assertThat(importRoots.excludeDirectories()).isEmpty();
}
use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ProjectViewParserTest method testDirectoriesAndTargets.
@Test
public void testDirectoriesAndTargets() throws Exception {
projectViewStorageManager.add(".blazeproject", "directories:", " java/com/google", " java/com/google/android", " -java/com/google/android/notme", "", "targets:", " //java/com/google:all", " //java/com/google/...:all", " -//java/com/google:thistarget");
projectViewParser.parseProjectView(new File(".blazeproject"));
errorCollector.assertNoIssues();
ProjectViewSet projectViewSet = projectViewParser.getResult();
ProjectViewSet.ProjectViewFile projectViewFile = projectViewSet.getTopLevelProjectViewFile();
assertThat(projectViewFile).isNotNull();
assertThat(projectViewFile.projectViewFile).isEqualTo(new File(".blazeproject"));
assertThat(projectViewSet.getProjectViewFiles()).containsExactly(projectViewFile);
ProjectView projectView = projectViewFile.projectView;
assertThat(projectView.getSectionsOfType(DirectorySection.KEY).get(0).items()).containsExactly(new DirectoryEntry(new WorkspacePath("java/com/google"), true), new DirectoryEntry(new WorkspacePath("java/com/google/android"), true), new DirectoryEntry(new WorkspacePath("java/com/google/android/notme"), false));
assertThat(projectView.getSectionsOfType(TargetSection.KEY).get(0).items()).containsExactly(TargetExpression.fromStringSafe("//java/com/google:all"), TargetExpression.fromStringSafe("//java/com/google/...:all"), TargetExpression.fromStringSafe("-//java/com/google:thistarget"));
}
use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ProjectViewParserTest method testCanParseWithMissingCarriageReturnAtEndOfSection.
@Test
public void testCanParseWithMissingCarriageReturnAtEndOfSection() {
projectViewStorageManager.add(".blazeproject", "directories:", " java/com/google");
projectViewParser.parseProjectView(new File(".blazeproject"));
ProjectView projectView = projectViewParser.getResult().getTopLevelProjectViewFile().projectView;
assertThat(projectView.getSectionsOfType(DirectorySection.KEY).get(0).items()).containsExactly(new DirectoryEntry(new WorkspacePath("java/com/google"), true));
}
use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ProjectViewParserTest method testCommentsAreParsed.
@Test
public void testCommentsAreParsed() throws Exception {
projectViewStorageManager.add(".blazeproject", "# comment", "directories:", " # another comment", " java/com/google", " # comment", " java/com/google/android", "");
projectViewParser.parseProjectView(new File(".blazeproject"));
errorCollector.assertNoIssues();
ProjectViewSet projectViewSet = projectViewParser.getResult();
ProjectViewSet.ProjectViewFile projectViewFile = projectViewSet.getTopLevelProjectViewFile();
ProjectView projectView = projectViewFile.projectView;
assertThat(projectView.getSectionsOfType(TextBlockSection.KEY).get(0).getTextBlock()).isEqualTo(new TextBlock(ImmutableList.of("# comment")));
assertThat(projectView.getSectionsOfType(DirectorySection.KEY).get(0).items()).containsExactly(new DirectoryEntry(new WorkspacePath("java/com/google"), true), new DirectoryEntry(new WorkspacePath("java/com/google/android"), true));
}
Aggregations