From f540871250b84eccb6fb45f73ca5dc6704b084e6 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 2 Feb 2025 15:42:33 +0800 Subject: [PATCH] Fix `transitiveCoursierProjects` cause OOM on large build (#4452) (#4454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve #4451 It seems that `transitiveCoursierProjects` is populated with repetitive transitive modules, that's why it only causes problem for large build. Please open all PRs as drafts and ensure that your fork of Mill has `settings/actions` / `Allow all actions and reusable workflows` enabled to run CI on your own fork of the Mill repo. Only once CI passes mark the PR as `Ready for review` and CI will run on the main Mill repo before we merge it. Co-authored-by: Mai Huy Hoàng --- scalalib/src/mill/scalalib/JavaModule.scala | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scalalib/src/mill/scalalib/JavaModule.scala b/scalalib/src/mill/scalalib/JavaModule.scala index 4c7e8e2f8b74..8a166bef3e4e 100644 --- a/scalalib/src/mill/scalalib/JavaModule.scala +++ b/scalalib/src/mill/scalalib/JavaModule.scala @@ -638,11 +638,10 @@ trait JavaModule * Coursier project of this module and those of all its transitive module dependencies */ def transitiveCoursierProjects: Task[Seq[cs.Project]] = Task { - Seq(coursierProject()) ++ - Task.traverse(compileModuleDepsChecked)(_.transitiveCoursierProjects)().flatten ++ - Task.traverse(moduleDepsChecked)(_.transitiveCoursierProjects)().flatten ++ - Task.traverse(runModuleDepsChecked)(_.transitiveCoursierProjects)().flatten ++ - Task.traverse(bomModuleDepsChecked)(_.transitiveCoursierProjects)().flatten + (Seq(coursierProject()) ++ + Task.traverse( + (compileModuleDepsChecked ++ moduleDepsChecked ++ runModuleDepsChecked ++ bomModuleDepsChecked).distinct + )(_.transitiveCoursierProjects)().flatten).distinctBy(_.module) } /**