use of com.google.idea.blaze.base.scope.BlazeContext 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.scope.BlazeContext in project intellij by bazelbuild.
the class ProjectViewVerifierTest method initTest.
@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
super.initTest(applicationServices, projectServices);
ExtensionPointImpl<BlazeSyncPlugin> ep = registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
ep.registerExtension(new BlazeSyncPlugin() {
@Override
public ImmutableList<WorkspaceType> getSupportedWorkspaceTypes() {
return ImmutableList.of(WorkspaceType.JAVA);
}
@Override
public Set<LanguageClass> getSupportedLanguagesInWorkspace(WorkspaceType workspaceType) {
return ImmutableSet.of(LanguageClass.JAVA);
}
});
fileOperationProvider = new MockFileOperationProvider(workspaceRoot);
applicationServices.register(FileOperationProvider.class, fileOperationProvider);
context = new BlazeContext();
context.addOutputSink(IssueOutput.class, errorCollector);
}
use of com.google.idea.blaze.base.scope.BlazeContext in project intellij by bazelbuild.
the class ProjectViewParserTest method initTest.
@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
super.initTest(applicationServices, projectServices);
context = new BlazeContext();
errorCollector = new ErrorCollector();
context.addOutputSink(IssueOutput.class, errorCollector);
projectViewParser = new ProjectViewParser(context, new WorkspacePathResolverImpl(workspaceRoot));
projectViewStorageManager = new MockProjectViewStorageManager();
applicationServices.register(ProjectViewStorageManager.class, projectViewStorageManager);
applicationServices.register(ExperimentService.class, new MockExperimentService());
registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
}
use of com.google.idea.blaze.base.scope.BlazeContext in project intellij by bazelbuild.
the class LanguageSupportTest method initTest.
@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
super.initTest(applicationServices, projectServices);
syncPlugins = registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
context = new BlazeContext();
context.addOutputSink(IssueOutput.class, errorCollector);
}
use of com.google.idea.blaze.base.scope.BlazeContext 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