use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.
the class ProjectViewVerifierTest method testExcludingExactRootResultsInIssue.
@Test
public void testExcludingExactRootResultsInIssue() {
ProjectViewSet projectViewSet = ProjectViewSet.builder().add(ProjectView.builder().add(ListSection.builder(DirectorySection.KEY).add(DirectoryEntry.include(new WorkspacePath("java/com/google/android/apps/example"))).add(DirectoryEntry.exclude(new WorkspacePath("java/com/google/android/apps/example")))).build()).build();
fileOperationProvider.addProjectView(projectViewSet);
ProjectViewVerifier.verifyProjectView(project, context, workspacePathResolver, projectViewSet, workspaceLanguageSettings);
errorCollector.assertIssues("java/com/google/android/apps/example is included, " + "but that contradicts java/com/google/android/apps/example which was excluded");
}
use of com.google.idea.blaze.base.model.primitives.WorkspacePath 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.model.primitives.WorkspacePath in project intellij by bazelbuild.
the class ProjectViewParserTest method testPrint.
@Test
public void testPrint() {
ProjectView projectView = ProjectView.builder().add(ListSection.builder(DirectorySection.KEY).add(DirectoryEntry.include(new WorkspacePath("java/com/google/one"))).add(DirectoryEntry.exclude(new WorkspacePath("java/com/google/two")))).add(ListSection.builder(TargetSection.KEY).add(TargetExpression.fromStringSafe("//java/com/google:one")).add(TargetExpression.fromStringSafe("//java/com/google:two"))).add(ScalarSection.builder(ImportSection.KEY).set(new WorkspacePath("some/file.blazeproject"))).build();
String text = ProjectViewParser.projectViewToString(projectView);
assertThat(text).isEqualTo(Joiner.on('\n').join("directories:", " java/com/google/one", " -java/com/google/two", "targets:", " //java/com/google:one", " //java/com/google:two", "import some/file.blazeproject"));
}
use of com.google.idea.blaze.base.model.primitives.WorkspacePath 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.model.primitives.WorkspacePath 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