private ProjectTask createModulesFilesTask(VirtualFile @NotNull [] files) {
    Map<Module, List<Pair<VirtualFile, Module>>> modulesMap = stream(files)
      .map(file -> new Pair<>(file, ProjectFileIndex.getInstance(myProject).getModuleForFile(file, false)))
      .filter(pair -> pair.second != null)
      .collect(groupingBy(pair -> pair.second));

    var tasks = map(
      modulesMap.entrySet(),
      entry -> new ModuleFilesBuildTaskImpl(entry.getKey(), false, map(entry.getValue(), pair -> pair.first))
    );

    return new ProjectTaskList(tasks);
  }
private ProjectTask createModulesFilesTask(VirtualFile @NotNull [] files)