There should be some mechanism of caching computations like cycle detection for each watch-mode run. We don't need to recheck for a cycle.
Perhaps locking the Makefile should be factored out of Build.run(). It could be done by updateTarget, the watch mode runner, etc. This would guarantee that makefile rules are constant while watch is in place so that cache is valid. Maybe a WeakMap from makefile to certain computations would suffice.
There should be some mechanism of caching computations like cycle detection for each watch-mode run. We don't need to recheck for a cycle.
Perhaps locking the Makefile should be factored out of Build.run(). It could be done by
updateTarget
, the watch mode runner, etc. This would guarantee that makefile rules are constant while watch is in place so that cache is valid. Maybe aWeakMap
from makefile to certain computations would suffice.