emezeske / lein-cljsbuild

Leiningen plugin to make ClojureScript development easy.
Other
1.1k stars 151 forks source link

Use JDK7 WatchService for triggering `cljsbuild auto` rebuilds, when available #229

Open cemerick opened 11 years ago

cemerick commented 11 years ago

Given the perf I'm seeing of the current manual mtime "watch" approach (only post-gh-219), I'm currently unconvinced of the need for inotify-style watching. References to cljs projects that exhibit poor CPU utilization while running lein cljsbuild auto are welcome as counterpoints.

lynaghk commented 11 years ago

FWIW, I've tried using the JDK7 watch service before and it seems like an actual nightmare to use. I got to a page and a half of code before I gave up.

If you do come up with a Clojure way to use it, you should absolutely wrap it and release as a separate lib. Or even better, come up with a decent Java wrapper.

hugoduncan commented 11 years ago

This is what I have used before: https://gist.github.com/hugoduncan/6393438

There is also: https://github.com/rplevy/ojo (I've not used it)

lynaghk commented 11 years ago

@hugoduncan thanks for the tips! I absolutely love it when I wish for stuff and it turns out that someone else has already made 'em = )

ivan commented 10 years ago

There's another implementation of this at https://github.com/juxt/dirwatch

On a separate note, switching to a WatchService without any polling would break my use case: compiling .cljs files on a cifs mount. Linux doesn't get inotify events when they're edited on the remote machine. I could work around it with a hack like https://github.com/rubyruy/watchntouch, though. (via this question)