@NotNull
  public static List<RawIncludedRuntimeModule> loadPluginModules(RuntimeModuleDescriptor mainModule, RuntimeModuleRepository repository,
                                                                 ResourceFileResolver resourceFileResolver) {
    try {
      List<RawIncludedRuntimeModule> modules = new ArrayList<>();
      Set<String> addedModules = new HashSet<>();
      modules.add(new RawIncludedRuntimeModule(mainModule.getModuleId(), ModuleImportance.FUNCTIONAL));
      addedModules.add(mainModule.getModuleId().getStringId());
      try (InputStream inputStream = resourceFileResolver.readResourceFile(mainModule.getModuleId(), PLUGIN_XML_PATH)) {
        if (inputStream == null) {
          throw new MalformedRepositoryException(PLUGIN_XML_PATH + " is not found in '" + mainModule.getModuleId().getStringId() + "' module in " 
                                                 + repository + " using " + resourceFileResolver + "; resources roots: " + mainModule.getResourceRootPaths());
        }
        XMLStreamReader reader = XMLInputFactory.newDefaultFactory().createXMLStreamReader(inputStream);
        int level = 0;
        boolean inContentTag = false;
        while (reader.hasNext()) {
          int event = reader.next();
          if (event == XMLStreamConstants.START_ELEMENT) {
            level++;
            String tagName = reader.getLocalName();
            if (level == 2 && tagName.equals("content")) {
              inContentTag = true;
            }
            else if (level == 3 && inContentTag && tagName.equals("module")) {
              String moduleAttribute = XmlStreamUtil.readFirstAttribute(reader, "name");
              int moduleNameEnd = moduleAttribute.indexOf('/');
              String moduleName = moduleNameEnd == -1 ? moduleAttribute : moduleAttribute.substring(0, moduleNameEnd);
              if (addedModules.add(moduleName)) {
                modules.add(new RawIncludedRuntimeModule(RuntimeModuleId.raw(moduleName), ModuleImportance.OPTIONAL));
              }
            }
          }
          else if (event == XMLStreamConstants.END_ELEMENT) {
            level--;
            if (level == 0 || level == 1 && inContentTag) {
              break;
            }
          }
        }
      }
      return modules;
    }
    catch (IOException | XMLStreamException e) {
      throw new MalformedRepositoryException("Failed to load included modules for " + mainModule.getModuleId().getStringId(), e);
    }
  }
@NotNull
  public static List<RawIncludedRuntimeModule> loadPluginModules(RuntimeModuleDescriptor mainModule, RuntimeModuleRepository repository,
                                                                 ResourceFileResolver resourceFileResolver)