use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ProjectViewVerifier method verifyIncludedPackagesAreNotExcluded.
private static boolean verifyIncludedPackagesAreNotExcluded(BlazeContext context, ProjectViewSet projectViewSet) {
boolean ok = true;
List<WorkspacePath> includedDirectories = projectViewSet.listItems(DirectorySection.KEY).stream().filter(entry -> entry.included).map(entry -> entry.directory).collect(toList());
for (WorkspacePath includedDirectory : includedDirectories) {
for (ProjectViewSet.ProjectViewFile projectViewFile : projectViewSet.getProjectViewFiles()) {
List<DirectoryEntry> directoryEntries = Lists.newArrayList();
for (ListSection<DirectoryEntry> section : projectViewFile.projectView.getSectionsOfType(DirectorySection.KEY)) {
directoryEntries.addAll(section.items());
}
for (DirectoryEntry entry : directoryEntries) {
if (entry.included) {
continue;
}
WorkspacePath excludedDirectory = entry.directory;
if (FileUtil.isAncestor(excludedDirectory.relativePath(), includedDirectory.relativePath(), false)) {
IssueOutput.error(String.format("%s is included, but that contradicts %s which was excluded", includedDirectory.toString(), excludedDirectory.toString())).inFile(projectViewFile.projectViewFile).submit(context);
ok = false;
}
}
}
}
return ok;
}
use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ImportRootsTest method testNoAddedExclusionsWithoutWorkspaceRootInclusion.
@Test
public void testNoAddedExclusionsWithoutWorkspaceRootInclusion() {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Bazel).add(new DirectoryEntry(new WorkspacePath("foo/bar"), true)).build();
assertThat(importRoots.rootDirectories()).containsExactly(new WorkspacePath("foo/bar"));
assertThat(importRoots.excludeDirectories()).isEmpty();
}
use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ImportRootsTest method testOverlappingDirectoriesAreFilteredOut.
@Test
public void testOverlappingDirectoriesAreFilteredOut() {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Blaze).add(new DirectoryEntry(new WorkspacePath("root"), true)).add(new DirectoryEntry(new WorkspacePath("root"), true)).add(new DirectoryEntry(new WorkspacePath("root/subdir"), true)).build();
assertThat(importRoots.rootDirectories()).containsExactly(new WorkspacePath("root"));
}
use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ImportRootsTest method testWorkspaceRootIsOnlyDirectoryLeft.
@Test
public void testWorkspaceRootIsOnlyDirectoryLeft() {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Blaze).add(new DirectoryEntry(new WorkspacePath("."), true)).add(new DirectoryEntry(new WorkspacePath("."), true)).add(new DirectoryEntry(new WorkspacePath("root/subdir"), true)).build();
assertThat(importRoots.rootDirectories()).containsExactly(new WorkspacePath("."));
}
use of com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry in project intellij by bazelbuild.
the class ImportRootsTest method testOverlappingExcludesAreFiltered.
@Test
public void testOverlappingExcludesAreFiltered() {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Blaze).add(new DirectoryEntry(new WorkspacePath("root"), false)).add(new DirectoryEntry(new WorkspacePath("root"), false)).add(new DirectoryEntry(new WorkspacePath("root/subdir"), false)).build();
assertThat(importRoots.excludeDirectories()).containsExactly(new WorkspacePath("root"));
}
Aggregations