by Mathnerd314 · 2y ago · 0 comments
Once it is, these will be possible. And I did misspeak: filesystem watching is not easily done by dynamic dependencies, but it will be easy for Rig.
Speaking as though Rig is full-featured, tracing command dependencies can easily be implemented by users (by adding strace on commands), and then the data from those traces can be stored in the build database. Then dynamic dependencies can be used to make those as dependencies on subsequent builds.
For filesystem watchers, Rig has the capability of having different build types. One of the functions of a build type is how to check a file for modification.
As of right now, it just returns true. Once incremental builds are added, files will be checked for modification in that build type's function.
To add support for filesystem watchers, I simply add a build type that checks the watcher for modifications in that function.
And for command tracing, the most significant issue is that it records both files read and files output. Even with dynamic dependencies it is difficult to record both of these dependency types properly. For example, Shake has this "multiple outputs" feature but it is actually really hacky and doesn't work. https://github.com/ndmitchell/shake/issues/382 The Pluto "sound and optimal" build paper discusses this briefly - they use a two-level file-command graph specifically to solve this problem. Since you have files-as-targets you will have trouble recording write dependencies, similarly to Shake.