void (@NotNull ProjectResolverContext resolverCtx, @NotNull IdeaModule gradleModule, @NotNull ExternalProject externalProject, @NotNull DataNode<ModuleData> ideModule, @NotNull SourceSetsProcessor processor) { Map<String, DataNode<GradleSourceSetData>> sourceSetsMap = new HashMap<>(); for (DataNode<GradleSourceSetData> dataNode : ExternalSystemApiUtil.findAll(ideModule, GradleSourceSetData.KEY)) { sourceSetsMap.put(dataNode.getData().getId(), dataNode); } for (ExternalSourceSet sourceSet : externalProject.getSourceSets().values()) { if (sourceSet == null || sourceSet.getSources().isEmpty()) continue; final String moduleId = getModuleId(resolverCtx, gradleModule, sourceSet); final DataNode<? extends ModuleData> moduleDataNode = sourceSetsMap.isEmpty() ? ideModule : sourceSetsMap.get(moduleId); if (moduleDataNode == null) continue; processor.process(moduleDataNode, sourceSet); } }