void (List<Build> builds, Set<GradleBuild> gradleBuilds) { Set<Build> updatedBuilds = new HashSet<>(); Map<File, Build> rootDirsToBuilds = new HashMap<>(); for (Build build : builds) { rootDirsToBuilds.put(build.getBuildIdentifier().getRootDir(), build); } for (GradleBuild gradleBuild : gradleBuilds) { Build build = rootDirsToBuilds.get(gradleBuild.getBuildIdentifier().getRootDir()); if (build == null) { continue; } for (GradleBuild includedGradleBuild : gradleBuild.getIncludedBuilds()) { Build buildToUpdate = rootDirsToBuilds.get(includedGradleBuild.getBuildIdentifier().getRootDir()); if (buildToUpdate instanceof DefaultBuild && updatedBuilds.add(buildToUpdate)) { ((DefaultBuild)buildToUpdate).setParentBuildIdentifier( new DefaultBuildIdentifier(gradleBuild.getBuildIdentifier().getRootDir())); } } } }