[java, highlighting, jigsaw] find module descriptor: support exclusions IDEA-354700

GitOrigin-RevId: ee96fec82905611a18aec82fd8554f7fb7d1dbb2
This commit is contained in:
Aleksey Dobrynin
2024-09-24 13:55:03 +02:00
committed by intellij-monorepo-bot
parent d5b64de3db
commit df7529c232
2 changed files with 58 additions and 0 deletions

View File

@@ -175,6 +175,9 @@ public final class JavaModuleGraphUtil {
JavaSourceRootType rootType = inTests ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
List<VirtualFile> sourceRoots = rootManager.getSourceRoots(rootType);
Set<VirtualFile> excludeRoots = ContainerUtil.newHashSet(ModuleRootManager.getInstance(module).getExcludeRoots());
if (!excludeRoots.isEmpty()) sourceRoots.removeIf(root -> excludeRoots.contains(root));
List<VirtualFile> files = ContainerUtil.mapNotNull(sourceRoots, root -> root.findChild(PsiJavaModule.MODULE_INFO_FILE));
if (files.isEmpty()) {
JavaResourceRootType resourceRootType = inTests ? JavaResourceRootType.TEST_RESOURCE : JavaResourceRootType.RESOURCE;