[SPIKE] Detect and propagate file changes on rebuild.

This should make it possible to live-reload only changed output files.

Needs review + tests.

/cc @stefanpenner 
Would it not be better to keep the stats from the last build to avoid recomputing them?