Collection<IndexableFilesIterator> (@NotNull Project project, @NotNull EntityStorage entityStorage, @NotNull Collection<EntityReference<?>> entityReferences, @NotNull Collection<Sdk> sdks, @NotNull Collection<LibraryId> libraryIds, @NotNull Collection<VirtualFile> filesFromAdditionalLibraryRootsProviders, @NotNull Collection<VirtualFile> filesFromIndexableSetContributors) { List<WorkspaceEntity> entities = ContainerUtil.mapNotNull(entityReferences, (ref) -> ref.resolve(entityStorage)); List<IndexableIteratorBuilder> builders = new ArrayList<>(getBuildersOnWorkspaceEntitiesRootsChange(project, entities, entityStorage)); for (Sdk sdk : sdks) { builders.addAll(IndexableIteratorBuilders.INSTANCE.forSdk(sdk.getName(), sdk.getSdkType().getName())); } for (LibraryId id : libraryIds) { builders.addAll(IndexableIteratorBuilders.INSTANCE.forLibraryEntity(id, true)); } if (!filesFromAdditionalLibraryRootsProviders.isEmpty()) { List<VirtualFile> roots = new ArrayList<>(filesFromAdditionalLibraryRootsProviders); for (AdditionalLibraryRootsProvider provider : AdditionalLibraryRootsProvider.EP_NAME.getExtensionList()) { for (SyntheticLibrary library : provider.getAdditionalProjectLibraries(project)) { boolean removed = roots.removeIf(file -> library.contains(file)); if (removed) { String name = library instanceof ItemPresentation ? ((ItemPresentation)library).getPresentableText() : null; builders.add(new SyntheticLibraryIteratorBuilder(library, name, library.getAllRoots())); } if (roots.isEmpty()) { break; } } } if (!roots.isEmpty()) { LOG.error("Failed fo find any SyntheticLibrary roots for " + StringUtil.join(roots, "\n")); } } if (!filesFromIndexableSetContributors.isEmpty()) { List<VirtualFile> roots = new ArrayList<>(filesFromIndexableSetContributors); for (IndexableSetContributor contributor : IndexableSetContributor.EP_NAME.getExtensionList()) { Set<VirtualFile> applicationRoots = contributor.getAdditionalRootsToIndex(); boolean removedApp = roots.removeIf(file -> VfsUtilCore.isUnder(file, applicationRoots)); if (removedApp) { builders.add( new IndexableSetContributorFilesIteratorBuilder(null, contributor.getDebugName(), applicationRoots, false, contributor)); } Set<VirtualFile> projectRoots = contributor.getAdditionalProjectRootsToIndex(project); boolean removedProject = roots.removeIf(file -> VfsUtilCore.isUnder(file, projectRoots)); if (removedProject) { builders.add(new IndexableSetContributorFilesIteratorBuilder(null, contributor.getDebugName(), projectRoots, true, contributor)); } if (roots.isEmpty()) { break; } } } return IndexableIteratorBuilders.INSTANCE.instantiateBuilders(builders, project, entityStorage); }