private static Library createAutoLibrary(
      String moduleName,
      Collection<VirtualFile> libraryFiles,
      @Nullable VirtualFile moduleXml,
      LibrariesContainer container) {
    String libName = LIBRARY_PREFIX + moduleName + AUTO_SUFFIX;

    NewLibraryEditor editor = new NewLibraryEditor();
    editor.setName(libName);
    for (VirtualFile classRoot : libraryFiles) {
      editor.addRoot(classRoot, OrderRootType.CLASSES);
    }

    if (moduleXml != null) {
      editor.addRoot(moduleXml, ModuleXmlRootDetector.MPS_MODULE_XML);
    }
    editor.setType(ModuleLibraryType.getInstance());
    editor.setProperties(new DummyLibraryProperties());
    return container.createLibrary(editor, LibraryLevel.PROJECT);
  }