New code for "incremental" building, by Matthew Whyte.
I've only had time to look at this briefly; I've fixed a few obvious problems but I imagine this will be pretty flaky for a while.