2

I have two different build commands that I use for my project

stack build -j8 --profile

and

stack build -j8  --ghc-options -DVERBOSE_SOLVING

There are hundreds of files in my projects. Whenever I change from one to the other command everything is rebuilt. Is there a way to keep the build increments of both?

1 Answer 1

2

You can tell stack where to keep the cache via --work-dir. The default is <project root>/.stack-work, but you can specify separate directories for your different build modes:

stack build -j8 --profile --work-dir .stack-work-profile

stack build -j8 --ghc-options -DVERBOSE_SOLVING --work-dir .stack-work-verbose-solving

I don't think there is a way to have stack automatically figure out different caches based on flags. If you really need this, you could whip up a script that would take a hash of the flag combination and redirect work-dir to .stack-work-<hash> or something.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.