Open danbroooks opened 4 years ago
One approach would be to use separate work directories for devel and testing. Can you try adding STACK_WORK=.stack-work-devel
or similar in front of your yesod devel
command and see if that fixes things for you? If it does, we may want to consider adding something like that to yesod devel
out of the box.
Yeah that seems to have worked, obviously it is now running two separate stack-work
directories though.
Though this seems to rectify the problem, it seems like a bit of a 'hammer to crack a nut' kind of solution, and perhaps not something to be fixed in this project, but infact potentially an issue with stack/cabal?
I have been hacking around with stack to try and pinpoint the issue, it seems like now my builds don't even behave how i want them to after a build with (lib + exe + test)
, I was getting a situation today where I would do a full build with stack printing out (lib + exe + test)
, then when i made a change in lib
it would re-build the whole thing, printing out (lib)
, as opposed to with the approach you have suggested, where it incrementally builds as you would want it to...
Do you think this is something I should move to the issues for stack
?
If I build with tests like so:
stack build --fast --test --flag myapp:library-only --flag myapp:dev
-- outputs:
myapp> build (lib + exe + test)
And then run this command (which is the raw command from yesod devel, minus the --exec "/home/dan/.local/bin/yesod devel-signal"
flag):
stack build --fast --file-watch myapp:lib --flag myapp:dev --flag myapp:library-only
I get this output:
Success! Waiting for next file change.
Type help for available commands. Press enter to force a rebuild.
Then when I make a file change, this results in the whole lib
project needing to be rebuilt, and the following output:
myapp> build (lib)
When developing my application, I am using the
yesod devel
command for incremental re-compilation, and I also have a set of tests that i run usingstack build --fast --flag myapp:library-only --flag myapp:dev --test --no-run-tests
. If I build the tests first, in the output I get:Then when I run
yesod devel
once the test have built I do not need to do a complete re-build to start the app, the inverse however isn't true. When I runyesod devel
from scratch, the build output says:Once I have done a full build, and I abort the command and run my test command, I get:
Again, and a full rebuild is required. Is there something I can do so that
yesod devel
includes building the tests as well? The raw command that devel generates here:https://github.com/yesodweb/yesod/blob/master/yesod-bin/Devel.hs#L354
Works with that part omitted, but presumably this line cannot be simply dropped. Would a PR be acceptable against the devel command that supports omitting this part of the command with a flag or something?
Or is there something I am doing wrong here in terms of the commands I'm running?