private static void mergeIncludedFiles(@NotNull RawProductModules rawProductModules,
                                         @NotNull String debugName,
                                         @NotNull ResourceFileResolver resolver,
                                         @NotNull Set<RawIncludedRuntimeModule> mainGroupModules,
                                         @NotNull Set<RuntimeModuleId> bundledPluginMainModules) throws IOException, XMLStreamException {
    for (RawIncludedFromData includedFromData : rawProductModules.getIncludedFrom()) {
      RuntimeModuleId includedId = includedFromData.getFromModule();
      InputStream inputStream = resolver.readResourceFile(includedId, "META-INF/" + includedId.getStringId() + "/product-modules.xml");
      if (inputStream == null) {
        throw new MalformedRepositoryException("'" + includedId.getStringId() + "' included in " +
                                               debugName + " doesn't contain product-modules.xml");
      }
      RawProductModules includedModules = ProductModulesXmlSerializer.parseModuleXml(inputStream);
      mergeIncludedFiles(includedModules, debugName, resolver, mainGroupModules, bundledPluginMainModules);
      for (RawIncludedRuntimeModule mainGroupModule : includedModules.getMainGroupModules()) {
        if (!includedFromData.getWithoutModules().contains(mainGroupModule.getModuleId())) {
          mainGroupModules.add(mainGroupModule);
        }
      }
      for (RuntimeModuleId pluginMainModule : includedModules.getBundledPluginMainModules()) {
        if (!includedFromData.getWithoutModules().contains(pluginMainModule)) {
          bundledPluginMainModules.add(pluginMainModule);
        }
      }
    }
  }
private static void mergeIncludedFiles(@NotNull RawProductModules rawProductModules,
                                         @NotNull String debugName,
                                         @NotNull ResourceFileResolver resolver,
                                         @NotNull Set<RawIncludedRuntimeModule> mainGroupModules,
                                         @NotNull Set<RuntimeModuleId> bundledPluginMainModules)