Eliminating need for 'shakeVersion'

16 views
Skip to first unread message

kan...@cakoose.com

unread,
Dec 16, 2014, 2:22:15 PM12/16/14
to shake-bui...@googlegroups.com
I'm looking for a build tool for a work project and have been reading about a few tools, including Shake. One axis of comparison is correctness and the 'shakeVersion' stuff scares me a little.

It seems like 'shakeVersion' lets you get better performance but increases the risk of an incorrect build if someone forgets to update 'shakeVersion' correctly. I think I'd be paranoid about incorrect builds and would probably use the hash trick (http://stackoverflow.com/questions/18532552).

I'm wondering why the hash trick isn't built into Shake as the default behavior. Does it make things really slow?

Neil Mitchell

unread,
Dec 16, 2014, 4:02:29 PM12/16/14
to Kannan Goundan, shake-bui...@googlegroups.com
Hi Kannan,

Another StackOverflow question that is relevant is:
http://stackoverflow.com/a/14885431/160673

You can certainly use the shakeVersion as a hash of the source file
approach, and it is very robust. It means if ANY rule in your project
changes, then EVERY rule builds. If the build system changes rarely
(say monthly), or rebuilding everything isn't too slow (say 5 minutes,
rather than 5 hours) then that seems perfectly reasonable.

However, I use the shakeVersion approach only as a backup, for very
occasional massive reorganisations of the build system. Generally,
it's not needed, and you can make it even less necessary by:

* Depending on things like compiler versions and other system
attributes which would be implicit in other build systems, for example
with addOracle:
http://hackage.haskell.org/package/shake/docs/Development-Shake.html#v:addOracle

* Putting regularly changing configuration data in tracked files, for
example using the Config module:
http://hackage.haskell.org/package/shake/docs/Development-Shake-Config.html

* If the output of a rule is heavily influenced by some source file
adding an explicit need to only that rule, for example in
https://github.com/snoyberg/minghc/blob/master/Main.hs#L76 I need the
file "Installer.hs" which has a big impact on the file generated by
that rule.

With those changes, I typically cover anything expected changing in
the build system, and then save shakeVersion for things that are
unexpected and rarer.

Thanks, Neil
Reply all
Reply to author
Forward
0 new messages