use of com.google.idea.blaze.base.sync.projectview.ImportRoots 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.sync.projectview.ImportRoots in project intellij by bazelbuild.
the class ImportRootsTest method testContainsWorkspacePath_differentRoot.
@Test
public void testContainsWorkspacePath_differentRoot() throws Exception {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Blaze).add(DirectoryEntry.include(new WorkspacePath("root"))).build();
assertThat(importRoots.containsWorkspacePath(new WorkspacePath("otherroot"))).isFalse();
}
use of com.google.idea.blaze.base.sync.projectview.ImportRoots in project intellij by bazelbuild.
the class ImportRootsTest method testContainsWorkspacePath_similarRoot.
@Test
public void testContainsWorkspacePath_similarRoot() throws Exception {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, BuildSystem.Blaze).add(DirectoryEntry.include(new WorkspacePath("root"))).build();
assertThat(importRoots.containsWorkspacePath(new WorkspacePath("root2/subdir"))).isFalse();
}
use of com.google.idea.blaze.base.sync.projectview.ImportRoots 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.sync.projectview.ImportRoots in project intellij by bazelbuild.
the class AlwaysPresentPythonSyncPlugin method validate.
@Override
public boolean validate(Project project, BlazeContext context, BlazeProjectData blazeProjectData) {
ImportRoots importRoots = ImportRoots.forProjectSafe(project);
if (importRoots == null) {
return true;
}
boolean hasPythonTarget = blazeProjectData.targetMap.targets().stream().filter(target -> importRoots.importAsSource(target.key.label)).anyMatch(target -> target.kindIsOneOf(Kind.allKindsForLanguage(LanguageClass.PYTHON)));
if (!hasPythonTarget) {
return true;
}
String pluginId = PythonPluginUtils.getPythonPluginId();
if (!PluginUtils.isPluginEnabled(pluginId)) {
IssueOutput.warn("Your project appears to contain Python targets. To enable Python support, " + "install/enable the JetBrains python plugin, then restart the IDE").navigatable(PluginUtils.installOrEnablePluginNavigable(pluginId)).submit(context);
return false;
}
return true;
}
Aggregations