[plugin model tests] improve module visibility check for modules included in multiple plugins (IJPL-206556)

If a module depends on a private module which is included in that same plugin, no problem should be reported even if the target module is included in other plugins as well.

GitOrigin-RevId: 5179f0311c250caa8410cfabda1c882e4b0541de
This commit is contained in:
Nikolay Chashnikov
2025-10-15 11:38:37 +00:00
committed by intellij-monorepo-bot
parent d161e67b72
commit cd2fc5d585
@@ -525,8 +525,8 @@ class PluginModelValidator(
if (SystemProperties.getBooleanProperty("intellij.plugin.model.check.module.visibility", false)) {
when (moduleInfo.descriptor.moduleVisibility) {
ModuleVisibility.PRIVATE -> {
val differentContainingPlugin = containingPlugins.find { it.pluginId != referencingPluginInfo.pluginId }
if (differentContainingPlugin != null) {
if (containingPlugins.all { it.pluginId != referencingPluginInfo.pluginId }) {
val differentContainingPlugin = containingPlugins.first()
registerError("""
|Module '$moduleName' has 'private' (default) visibility in '${differentContainingPlugin.pluginId}' but it is used as a dependency in
|a plugin '${referencingPluginInfo.pluginId}'.