@NotNull
  private List<ModuleInfo> prepareModuleInfos(@NotNull Set<ModuleNode> modules) {
    Set<String> requiredPackages = modules.stream()
      .map(ModuleNode::getRequiredPackages)
      .flatMap(Collection::stream)
      .collect(Collectors.toSet());

    List<ModuleInfo> moduleInfo = new ArrayList<>();
    for (ModuleNode moduleNode : modules) {
      if (moduleNode.getDescriptor() != null) {
        myLogger.info("Module descriptor already exists in " + moduleNode);
        continue;
      }
      for (String packageName : moduleNode.getDeclaredPackages()) {
        if (requiredPackages.contains(packageName)) {
          moduleNode.addExport(packageName);
        }
      }

      PsiDirectory rootDir = moduleNode.getRootDir();
      if (rootDir != null) {
        moduleInfo.add(new ModuleInfo(rootDir, moduleNode));
      }
      else {
        myLogger.info("Skipped module " + moduleNode + " because it doesn't have production source root");
      }
      myProgressTracker.increment();
    }
    return moduleInfo;
  }
@NotNull
  private List<ModuleInfo> prepareModuleInfos(@NotNull Set<ModuleNode> modules)