Skip to content

Commit d9c5b37

Browse files
Wrap MillBuildRootModule#scriptSourcesPaths in BuildCtx.watchValue (#5954)
This ensures that if you add new `package.mill` files in subfolders, they get picked up correctly. Previously they may get missed if the `MillBuildRootModule` does not get re-instantiated (e.g. this happens if you define a `mill-build/build.mill` meta-build file) We don't want to just do a `Task.Source(BuildCtx.workspaceRoot)` because that seems to cause issues, presumably due to trying to hash the entire project (including `out/` folder) which is slow and expensive This also lets us clean up some logic in `CodeGen`, replacing `os.write.over`s with `os.write`s since we can avoid returning duplicate entries from `walkBuildFiles` Tested manually --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 503e117 commit d9c5b37

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

runner/meta/src/mill/meta/MillBuildRootModule.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ trait MillBuildRootModule()(using
4141

4242
override def scalaVersion: T[String] = BuildInfo.scalaVersion
4343

44-
val scriptSourcesPaths = BuildCtx.withFilesystemCheckerDisabled {
45-
FileImportGraph
46-
.walkBuildFiles(rootModuleInfo.projectRoot / os.up, rootModuleInfo.output)
47-
.sorted // Ensure ordering is deterministic
44+
val scriptSourcesPaths = BuildCtx.watchValue {
45+
BuildCtx.withFilesystemCheckerDisabled {
46+
FileImportGraph
47+
.walkBuildFiles(rootModuleInfo.projectRoot / os.up, rootModuleInfo.output)
48+
.sorted // Ensure ordering is deterministic
49+
}
4850
}
4951

5052
/**

0 commit comments

Comments
 (0)