Closed
Description
Moving from an internal issue tracker:
Just an idea I had: what about having a command (maybe autobuild) that scans a directory for any changes to files (via fsnotify) and, on a change, automatically rebuilds? I know this is something that I would use regularly.
Not high priority, just an idea.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
chrisdone commentedon May 29, 2015
Yeah, it would be neat if Shake coud do this as it already knows what files to be tracking. @ndmitchell But I guess with a simple notification of "one file in this directory and subdirs changed" we can call
build
and it's fine.There's definitely general demand for this; there are like 5 proper projects for recompiling like this out there.
ndmitchell commentedon May 29, 2015
Via
shakeLiveFiles
you can get notified of which files Shake is interested in. There's no direct support for what you describe, but it is planned/vaguely thought about. Now I use file tracker in ghcid, it's much more likely.snoyberg commentedon May 29, 2015
If we want to do this properly, we'd have to go quite a bit deeper, like looking at all of the .hi files to track the
addDependentFiles
in them (something I'm dealing with right now on theyesod devel
front).snoyberg commentedon May 29, 2015
Relevant links: yesodweb/yesod#955 (comment) and #105
ndmitchell commentedon May 29, 2015
I would have thought a far simpler "anything under this directory changes, i rerun build" would be sufficient - as long as you get build fast enough. Generally people only put dependent files in the same folder as the project.
snoyberg commentedon May 29, 2015
That could work. We'd probably get hit with some annoying corner cases, such as
.git
anddist
, where there are lots of files and adding watchers for all of them could actually slow us down significantly. Special casing those may solve that problem though.chrisdone commentedon May 29, 2015
I suppose if your project generates a lot of files, watching the whole dir could come with a performance penalty? In any case watching the whole dir vs just the shakeLiveFiles vs more detail could be considered levels of implementation of the feature.
snoyberg commentedon Jun 30, 2015
Working on this now, I want it too much to wait :)
Add the --file-watch flag #113 (yay!)
snoyberg commentedon Jun 30, 2015
Closing, this is implemented. If there are bugs, we can follow up in separate issues.