Search code examples
shake-build-system

Is there a way to run shake assuming some rule is up-to-date?


We would like to run a Shake build while assuming some target is built, e.g. something like

./Build.hs --dont-rebuild my-target

Reading the docs it seems there should be a way to do that but I can't find it.


Solution

  • The ShakeOptions setting you are looking for is shakeRebuild=[(RebuildLater,"my-target")]. This setting causes Shake to not rebuild my-target in this run. From the documentation of RebuildLater:

    This assumption is unsafe, and may lead to incorrect build results in this run. Assume these files are clean in this run, but test them normally in future runs.

    This setting can be applied using the command line --skip=my-target. A few caveats:

    • my-target won't rebuild in this run, by things it depends on might, if they need to.
    • If you next run without skipping my-target, it will rebuild if it needs to (the --skip is not sticky).