private static void addArtifactsBuildTasks(@Nullable Collection<? extends ProjectTask> tasks,
                                             @NotNull MultiMap<String, String> buildTasksMap,
                                             @NotNull MultiMap<String, VersionSpecificInitScript> versionedInitScripts) {
    if (ContainerUtil.isEmpty(tasks)) return;

    for (ProjectTask projectTask : tasks) {
      if (!(projectTask instanceof ProjectModelBuildTask<?> projectModelBuildTask)) continue;

      for (GradleBuildTasksProvider buildTasksProvider : GradleBuildTasksProvider.EP_NAME.getExtensions()) {
        if (buildTasksProvider.isApplicable(projectModelBuildTask)) {
          buildTasksProvider.addBuildTasks(
            projectModelBuildTask,
            task -> buildTasksMap.putValue(task.getLinkedExternalProjectPath(), task.getName()),
            (String path, VersionSpecificInitScript script) -> versionedInitScripts.putValue(path, script)
          );
        }
      }
    }
  }
private static void addArtifactsBuildTasks(@Nullable Collection<? extends ProjectTask> tasks,
                                             @NotNull MultiMap<String, String> buildTasksMap,
                                             @NotNull MultiMap<String, VersionSpecificInitScript> versionedInitScripts)