In Shake, files that are dirty are hard to identify. If your file of interest depends on any oracles (even transitively), then the file is considered "dirty", since oracles are always dirty. However, if Shake repeats the dependent rules / oracles, and they do not change, then at that moment it is considered clean again. As a result, most rules are considered dirty before everything is started, and only after the start of some rules will it become clean.
I got a ticket to make something better. One of the options will receive the given rule to say which leaves depend on it and are dirty - this will be a list of oracles (which you reasonably expect not to change), and if it contains a list of source files, you can expect it to be rebuilt.
(I would welcome suggestions if anyone has any good ideas.)
source share