guard / listen

The Listen gem listens to file modifications and notifies you about the changes.
https://rubygems.org/gems/listen
MIT License
1.92k stars 246 forks source link

Add support for JRuby using NIO.2 WatchService #462

Open headius opened 5 years ago

headius commented 5 years ago

I believe listen on JRuby will fall back on a polling implementation currently, since most of the adapters require C extensions. Specifically, I was looking at the Windows adapter, which needs the "wdm" extension on CRuby.

However, JRuby runs on the JDK, which has a built-in, cross-platform filesystem eventing API:

https://docs.oracle.com/javase/tutorial/essential/io/notification.html

Judging by the other adapters, it seems like we wouldn't need to write much code to support efficient filesystem monitoring for JRuby on all platforms where the JDK exists (which is pretty much all platforms).

Opening this issue in case someone with more time than me wants to give it a shot.

bratish commented 5 years ago

I am willing to work on this. Might require some assistance though. Please let me know.

headius commented 5 years ago

@bratish Sure, have a look at the tutorial and there are some examples of importing a Java API in our samples directory. Once you have imported something, it's mostly just plain Ruby.

bratish commented 5 years ago

Thanks, @headius. @floehopper has submitted a patch already.

donv commented 3 years ago

Any progress on this one?

headius commented 2 years ago

@donv I guess @floehopper PR was closed but hopefully we can still make this happen. Might need someone else to jump in on it.

floehopper commented 2 years ago

I'm afraid I'm unlikely to have time to work on the PR in the near future. I hope someone else can help.

headius commented 2 years ago

@floehopper No worries, hopefully what you have will be a good start for someone. I tweeted out a call for help!

https://twitter.com/headius/status/1481693790645673984

ColinDKelley commented 1 year ago

@headius Any updates here? I agree that it looks very possible. @bratish Would you possibly be interested still?

ColinDKelley commented 6 months ago

@headius @bratish Any updates here?

headius commented 6 months ago

No updates on my end. It appears that MacOS still does not have a good way to implement this on JVM, so any NIO-based version should probably just be used on Linux and Windows which both have good file notification APIs. I don't have time to work on this currently though.