You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Draft: Implement watching file paths via oslib.watch (#5068)
Currently watching files uses polling which is inefficient with large
codebases. On my laptop `./mill --watch` uses 20% CPU just to watch the
files for changes.
This uses `oslib`'s `watch` module to watch for the file changes instead
of polling them.
We had to update oslib (com-lihaoyi/os-lib#386)
to:
- add a capability of filtering what folders it watches. This is needed
because watching large generated folders like `out` or `.bloop` emits
Java FS watcher `OVERFLOW` events.
- remove the random `println`'s that `oslib.watch` had.
The current approach to watching is to watch the workspace root via FS
watching. FS watching only works with folders and we have to watch
`root/build.mill`, and thus, `root/`, so everything else falls under it.
Mac OS watcher performs watching recursively natively, but on linux
oslib adds recursive watches itself, so we use `oslib.watch` filter to
prevent watching anything that is not an ancestor of watched root. For
example, if we have source at `root/module-a/src/`, we'll watch `root/`,
`root/module-a/` and `root/`.
Finally, events are filtered so that unrelated changes (like creating
`root/random-file.txt`) does not trigger reevaluation.
The fs watching is enabled by default and can be disabled via
`--watch-via-fs-notify=false`.
`0.12.x` version: #5073
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
0 commit comments