public static void writeModuleXml(@NotNull RawRuntimeModuleDescriptor descriptor, @NotNull PrintWriter output, XMLOutputFactory factory)
    throws XMLStreamException {
    XMLStreamWriter writer = factory.createXMLStreamWriter(output);
    writer.writeStartDocument("UTF-8", "1.0");
    writeEolAndIndent(writer, 0);
    writer.writeStartElement(MODULE_TAG);
    writer.writeAttribute(NAME_ATTRIBUTE, descriptor.getId());
    List<String> dependencies = descriptor.getDependencies();
    if (!dependencies.isEmpty()) {
      writeEolAndIndent(writer, 1);
      writer.writeStartElement("dependencies");
      for (String dependency : dependencies) {
        writeEolAndIndent(writer, 2);
        writer.writeEmptyElement(MODULE_TAG);
        writer.writeAttribute(NAME_ATTRIBUTE, dependency);
      }
      writeEolAndIndent(writer, 1);
      writer.writeEndElement();
    }
    List<String> roots = descriptor.getResourcePaths();
    if (!roots.isEmpty()) {
      writeEolAndIndent(writer, 1);
      writer.writeStartElement("resources");
      for (String root : roots) {
        writeEolAndIndent(writer, 2);
        writer.writeEmptyElement(RESOURCE_ROOT_TAG);
        writer.writeAttribute(PATH_ATTRIBUTE, root);
      }
      writeEolAndIndent(writer, 1);
      writer.writeEndElement();
    }
    writeEolAndIndent(writer, 0);
    writer.writeEndElement();
    writer.writeEndDocument();
    output.flush();
  }
public static void writeModuleXml(@NotNull RawRuntimeModuleDescriptor descriptor, @NotNull PrintWriter output, XMLOutputFactory factory)