public static Promise<Void> addLibraryToModule(@NotNull RepositoryLibraryDescription libraryDescription,
                                                 @NotNull Module module,
                                                 @NotNull String defaultVersion,
                                                 @Nullable DependencyScope  scope,
                                                 boolean downloadSources,
                                                 boolean downloadJavaDocs) {
    RepositoryLibraryPropertiesModel model = new RepositoryLibraryPropertiesModel(defaultVersion, downloadSources, downloadJavaDocs);
    if (!ApplicationManager.getApplication().isUnitTestMode()) {
      RepositoryLibraryPropertiesDialog dialog = new RepositoryLibraryPropertiesDialog(
        module.getProject(),
        model,
        libraryDescription,
        false, true, false);
      if (!dialog.showAndGet()) {
        return Promises.rejectedPromise();
      }
    }
    IdeaModifiableModelsProvider modifiableModelsProvider = new IdeaModifiableModelsProvider();
    final ModifiableRootModel modifiableModel = modifiableModelsProvider.getModuleModifiableModel(module);
    RepositoryLibrarySupport librarySupport = new RepositoryLibrarySupport(module.getProject(), libraryDescription, model);
    assert modifiableModel != null;
    librarySupport.addSupport(
      module,
      modifiableModel,
      modifiableModelsProvider,
      scope);
    ApplicationManager.getApplication().runWriteAction(modifiableModel::commit);
    return Promises.resolvedPromise(null);
  }
public static Promise<Void> addLibraryToModule(@NotNull RepositoryLibraryDescription libraryDescription,
                                                 @NotNull Module module,
                                                 @NotNull String defaultVersion,
                                                 @Nullable DependencyScope  scope,
                                                 boolean downloadSources,
                                                 boolean downloadJavaDocs)