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

Comments

Projects
None yet
3 participants
@snoyberg
Contributor

snoyberg commented May 29, 2015

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

This comment has been minimized.

Member

chrisdone commented 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

This comment has been minimized.

Contributor

ndmitchell commented 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

This comment has been minimized.

Contributor

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

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented May 29, 2015

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

@ndmitchell

This comment has been minimized.

Contributor

ndmitchell commented 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

This comment has been minimized.

Contributor

snoyberg commented May 29, 2015

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

This comment has been minimized.

Member

chrisdone commented 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 snoyberg modified the milestones: 0.2.0.0, Later improvements Jun 30, 2015

@snoyberg snoyberg self-assigned this Jun 30, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jun 30, 2015

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

snoyberg added a commit that referenced this issue Jun 30, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Jun 30, 2015

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

@snoyberg snoyberg closed this Jun 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment