General summary/comments
When only a single executable is required to be (re)built, building and running that executable installs all other binaries configured.
Steps to reproduce
- Start a new stack project;
- Configure more than one (preferably many) executable;
- Build all executables;
- Make trivial modification to the
Main.hs for any executable;
- Run
stack run that_executable;
- Stack installs all exes, even though only a single executable was rebuilt.
Expected
Since the source changes (step 4 above) affected only a single executable, the reasonable expectation from Stack is that it rebuilds and run that executable alone—do nothing more.
Actual
Instead, as mentioned, Stack installs every executable whenever there is any changes made. This is wasteful and unnecessary.
The back story: was trying my hand at AOC 2022. I configured each day's puzzle as a separate binary, for example, under app/day12_1 and app/day12_2. Due to the incremental nature of development, every time I make changes to day12_2, for example, every other executable is installed before day12_2 is run. That is 12x2, 24 binary installs when a single executable source was changed! Needless to say, this increases the turn around time. And it gets worse with every passing day, when I keep adding more and more executables.
My current work around is to configure one executable at a time, and comment out the rest. I feel shouldn't have to do this. Stack is acting suboptimally. Executables are supposed to be independent of each other; changing one shouldn't cause any action to be taken upon the rest (unless their common dependency changes, which in this case, it didn't).
I believe I've tried all command line options to get Stack to break out of it, but without any success.
Stack version
Version 2.9.1.
Method of installation
Official binary, downloaded via haskellstack.org or from Stack's repository
General summary/comments
When only a single executable is required to be (re)built, building and running that executable installs all other binaries configured.
Steps to reproduce
Main.hsfor any executable;stack run that_executable;Expected
Since the source changes (step 4 above) affected only a single executable, the reasonable expectation from Stack is that it rebuilds and run that executable alone—do nothing more.
Actual
Instead, as mentioned, Stack installs every executable whenever there is any changes made. This is wasteful and unnecessary.
The back story: was trying my hand at AOC 2022. I configured each day's puzzle as a separate binary, for example, under
app/day12_1andapp/day12_2. Due to the incremental nature of development, every time I make changes today12_2, for example, every other executable is installed beforeday12_2is run. That is 12x2, 24 binary installs when a single executable source was changed! Needless to say, this increases the turn around time. And it gets worse with every passing day, when I keep adding more and more executables.My current work around is to configure one executable at a time, and comment out the rest. I feel shouldn't have to do this. Stack is acting suboptimally. Executables are supposed to be independent of each other; changing one shouldn't cause any action to be taken upon the rest (unless their common dependency changes, which in this case, it didn't).
I believe I've tried all command line options to get Stack to break out of it, but without any success.
Stack version
Version 2.9.1.
Method of installation
Official binary, downloaded via haskellstack.org or from Stack's repository