Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if running shake would rebuild a target (without actually trying to build it)?

In certain situations, I want to know very quickly if a certain target file is up-to-date, i.e. whether or not building it with shake would run any of the rules transitively contributing to the target.

What's the best way to achieve this with shake?

My question is somewhat related to Shake: Signal whether anything had to be rebuilt at all. However, I do not want to run the actual build because I do not want to touch any of my build products.

like image 761
stefanwehr Avatar asked Aug 17 '15 16:08

stefanwehr


1 Answers

In Shake what files are "dirty" is a bit difficult to determine. 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 reruns the dependent rules/oracles and they don't change, then at that point it is considered clean again. As a result, most rules are considered dirty before anything has been run, and only after running some rules does it become clean.

I have raised a ticket to do something better. One option would be given a target rule, to say which leaves depend on it and are dirty - that would list the oracles (which you reasonably expect not to change) and if it lists any source files, you would expect it to rebuild.

(I'd welcome suggestions if anyone has any good ideas.)

like image 171
Neil Mitchell Avatar answered Oct 03 '22 00:10

Neil Mitchell