private static void setupNestedBuildHierarchy(
    @NotNull Collection<DefaultGradleLightBuild> builds,
    @NotNull Collection<? extends GradleBuild> gradleBuilds
  ) {
    Set<DefaultGradleLightBuild> updatedBuilds = new HashSet<>();
    Map<File, DefaultGradleLightBuild> rootDirsToBuilds = new HashMap<>();
    for (DefaultGradleLightBuild build : builds) {
      BuildIdentifier buildIdentifier = build.getBuildIdentifier();
      rootDirsToBuilds.put(buildIdentifier.getRootDir(), build);
    }

    for (GradleBuild gradleBuild : gradleBuilds) {
      BuildIdentifier buildIdentifier = gradleBuild.getBuildIdentifier();
      DefaultGradleLightBuild build = rootDirsToBuilds.get(buildIdentifier.getRootDir());
      if (build == null) {
        continue;
      }

      for (GradleBuild includedGradleBuild : gradleBuild.getIncludedBuilds()) {
        DefaultGradleLightBuild buildToUpdate = rootDirsToBuilds.get(includedGradleBuild.getBuildIdentifier().getRootDir());
        if (buildToUpdate != null && updatedBuilds.add(buildToUpdate)) {
          buildToUpdate.setParentBuildIdentifier(new DefaultBuildIdentifier(buildIdentifier.getRootDir()));
        }
      }
    }
  }
private static void setupNestedBuildHierarchy(
    @NotNull Collection<DefaultGradleLightBuild> builds,
    @NotNull Collection<? extends GradleBuild> gradleBuilds
  )