Don't watch files for non-library components that are not being built#3565
Conversation
|
Just realised I had the checklist etc but hadn't actually done it. How I tested: I used a project with a single package with an executable and test suite. Ran |
|
This looks OK, and I've approved, but just doing a little more testing. I noticed some strange behavior, not sure if it's this patch or something else. |
snoyberg
left a comment
There was a problem hiding this comment.
Alright, I've confirmed that there's something wrong with this patch. When working on the Stack codebase itself: if I use a stack executable built from master, all is well. Using this branch, I see the following:
Details
$ stack build --file-watch
stack-1.6.0: unregistering (local file changes: src/test/Network/HTTP/Download/VerifiedSpec.hs src/test/Spec.hs src/test/Stack/ArgsSpec.hs src/te...)
stack-1.6.0: build (lib + exe)
Preprocessing library for stack-1.6.0..
Building library for stack-1.6.0..
Preprocessing executable 'stack' for stack-1.6.0..
Building executable 'stack' for stack-1.6.0..
stack-1.6.0: copy/register
Installing library in /Users/michael/Documents/stack/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/lib/x86_64-osx-ghc-8.0.2/stack-1.6.0-5MKfzwUAGDM5FSQ3rYxlAo
Installing executable stack in /Users/michael/Documents/stack/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/bin
Registering library for stack-1.6.0..
ExitSuccess
Type help for available commands. Press enter to force a rebuild.
stack-1.6.0: unregistering (local file changes: src/test/Network/HTTP/Download/VerifiedSpec.hs src/test/Spec.hs src/test/Stack/ArgsSpec.hs src/te...)
stack-1.6.0: build (lib + exe)
Preprocessing library for stack-1.6.0..
Building library for stack-1.6.0..
Preprocessing executable 'stack' for stack-1.6.0..
Building executable 'stack' for stack-1.6.0..
stack-1.6.0: copy/register
Installing library in /Users/michael/Documents/stack/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/lib/x86_64-osx-ghc-8.0.2/stack-1.6.0-5MKfzwUAGDM5FSQ3rYxlAo
Installing executable stack in /Users/michael/Documents/stack/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/bin
Registering library for stack-1.6.0..
ExitSuccess
Type help for available commands. Press enter to force a rebuild.
stack-1.6.0: unregistering (local file changes: src/test/Network/HTTP/Download/VerifiedSpec.hs src/test/Spec.hs src/test/Stack/ArgsSpec.hs src/te...)
stack-1.6.0: build (lib + exe)
Preprocessing library for stack-1.6.0..
Building library for stack-1.6.0..
Preprocessing executable 'stack' for stack-1.6.0..
Building executable 'stack' for stack-1.6.0..
stack-1.6.0: copy/register
Installing library in /Users/michael/Documents/stack/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/lib/x86_64-osx-ghc-8.0.2/stack-1.6.0-5MKfzwUAGDM5FSQ3rYxlAo
Installing executable stack in /Users/michael/Documents/stack/.stack-work/install/x86_64-osx/lts-9.14/8.0.2/bin
Registering library for stack-1.6.0..
ExitSuccess
Type help for available commands. Press enter to force a rebuild.
Note that I have made no file changes in the interim.
|
Hmm, I'm stumped. Haven't tried to reproduce it, but the change looks good. In particular:
Curious! |
|
OK, I have reproduced the issue spotted by @snoyberg. I believe the I've added a commit which uses the same logic in both places, so the ultimate effect of all the changes is more or less to replace |
|
Looks great now, thanks! |
Attempt at a fix for #3483, following the comment there. I'm not quite up on the internals of stack so let me know if this is the wrong direction. It raised a couple of questions about how things work, which may make it into their own issues. One in particular: is the library component of a package always built, regardless of targets?
Note: Documentation fixes for https://docs.haskellstack.org/en/stable/ should target the "stable" branch, not master.
Please include the following checklist in your PR:
Please also shortly describe how you tested your change. Bonus points for added tests!