Search in sources :

Example 1 with ImportRoots

use of com.google.idea.blaze.base.sync.projectview.ImportRoots 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();
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) ImportRoots(com.google.idea.blaze.base.sync.projectview.ImportRoots) DirectoryEntry(com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry) Test(org.junit.Test)

Example 2 with ImportRoots

use of com.google.idea.blaze.base.sync.projectview.ImportRoots 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"));
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) ImportRoots(com.google.idea.blaze.base.sync.projectview.ImportRoots) DirectoryEntry(com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry) Test(org.junit.Test)

Example 3 with ImportRoots

use of com.google.idea.blaze.base.sync.projectview.ImportRoots in project intellij by bazelbuild.

the class ImportRootsTest method testContainsWorkspacePath_samePath.

@Test
public void testContainsWorkspacePath_samePath() throws Exception {
    ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Blaze).add(DirectoryEntry.include(new WorkspacePath("root"))).build();
    assertThat(importRoots.containsWorkspacePath(new WorkspacePath("root"))).isTrue();
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) ImportRoots(com.google.idea.blaze.base.sync.projectview.ImportRoots) Test(org.junit.Test)

Example 4 with ImportRoots

use of com.google.idea.blaze.base.sync.projectview.ImportRoots 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("."));
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) ImportRoots(com.google.idea.blaze.base.sync.projectview.ImportRoots) DirectoryEntry(com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry) Test(org.junit.Test)

Example 5 with ImportRoots

use of com.google.idea.blaze.base.sync.projectview.ImportRoots 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"));
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) ImportRoots(com.google.idea.blaze.base.sync.projectview.ImportRoots) DirectoryEntry(com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry) Test(org.junit.Test)

Aggregations

ImportRoots (com.google.idea.blaze.base.sync.projectview.ImportRoots)29 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)25 Test (org.junit.Test)16 DirectoryEntry (com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry)11 File (java.io.File)11 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)7 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)7 ImmutableList (com.google.common.collect.ImmutableList)6 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)6 Project (com.intellij.openapi.project.Project)6 ImmutableSet (com.google.common.collect.ImmutableSet)5 Lists (com.google.common.collect.Lists)5 Kind (com.google.idea.blaze.base.model.primitives.Kind)5 List (java.util.List)5 Nullable (javax.annotation.Nullable)5 ArtifactLocation (com.google.idea.blaze.base.ideinfo.ArtifactLocation)4 LanguageClass (com.google.idea.blaze.base.model.primitives.LanguageClass)4 IssueOutput (com.google.idea.blaze.base.scope.output.IssueOutput)4 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)4 Set (java.util.Set)4