If I run stack clean && stack build --profile
, I get an executable that is slower than if I had run stack clean && stack build
, this is normal and fine.
If I run stack clean && stack build --profile && stack build
then I get an executable that is just as slow, and this persists until I run stack clean && stack build
I have set the option rebuild-ghc-options: true
in stack.yaml, but I'm either not understanding the proper use of stack or I'm misusing it somehow, because I don't have a clear mental model of what state is affected when I run stack build
. It is clearly affecting future builds until I run stack clean
, is it also affecting dependencies? How do I make sure that when I build with default settings that I get the same executable out every time?
Edit: Let me be clear, I understand what is going on mechanically, I understand that stack build
rebuilds only what "needs to be rebuilt", the thing is if I run stack build
what I want is for it to rebuild everything that required to make a release build, and if I had just built with profiling, and that means to rebuild everything, so be it.
Edit 2: Okay, I know that stack has no idea about a release or profiling build etc, that there's no fundamental distinction, but --profile just changes ghc flags right? I guess what I'm asking is, why doesn't rebuild-ghc-options
do what it says on the tin? If the ghc options change, why isn't it fully rebuilding the project? What does that flag actually do?