Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-rebuild on file change #113

Closed
snoyberg opened this issue May 29, 2015 · 9 comments
Closed

Auto-rebuild on file change #113

snoyberg opened this issue May 29, 2015 · 9 comments
Assignees
Milestone

Comments

@snoyberg
Copy link
Contributor

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.

@snoyberg snoyberg added this to the Later improvements milestone May 29, 2015
@chrisdone
Copy link
Member

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
Copy link
Contributor

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
Copy link
Contributor Author

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 the yesod devel front).

@snoyberg
Copy link
Contributor Author

Relevant links: yesodweb/yesod#955 (comment) and #105

@ndmitchell
Copy link
Contributor

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
Copy link
Contributor Author

That could work. We'd probably get hit with some annoying corner cases, such as .git and dist, 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
Copy link
Member

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 snoyberg modified the milestones: 0.2.0.0, Later improvements Jun 30, 2015
@snoyberg snoyberg self-assigned this Jun 30, 2015
@snoyberg
Copy link
Contributor Author

Working on this now, I want it too much to wait :)

snoyberg added a commit that referenced this issue Jun 30, 2015
@snoyberg
Copy link
Contributor Author

Closing, this is implemented. If there are bugs, we can follow up in separate issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants