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

Add MacOSXWatchService #138

Merged
merged 1 commit into from Apr 3, 2018

Conversation

Projects
None yet
3 participants
@eatkins
Copy link
Contributor

commented Mar 29, 2018

This watch service is taken from my CloseWatch plugin, found at
https://github.com/swoval/swoval

It uses a native jni library, provided by apple-file-events, to receive
file events from the os. I more or less copied this file from the close
watch source code with some minor modifications given that it is now in
the sbt.io package.

@eed3si9n
Copy link
Member

left a comment

Travis CI failed for Scala 2.10. Probably need to make small adjustments to supply type annotation or sugar.


private[this] val executor =
Executors.newSingleThreadExecutor(new ThreadFactory("sbt.io.MacOSXWatchService"))
private[this] val watcher: FileEventsApi = FileEventsApi.apply(onFileEvent, _ => {})

This comment has been minimized.

Copy link
@eed3si9n

eed3si9n Mar 29, 2018

Member

This failed compilation on Travis for 2.10:

[error] /home/travis/build/sbt/io/io/src/main/scala/sbt/io/MacOSXWatchService.scala:21:66: missing arguments for method onFileEvent in class MacOSXWatchService;
[error] follow this method with `_' if you want to treat it as a partially applied function
[error]   private[this] val watcher: FileEventsApi = FileEventsApi.apply(onFileEvent, _ => {})
[error]                                                                  ^
}

def onFileEvent(fileEvent: FileEvent): Unit = {
executor.submit((() => {

This comment has been minimized.

Copy link
@eed3si9n

eed3si9n Mar 29, 2018

Member
[error] /home/travis/build/sbt/io/io/src/main/scala/sbt/io/MacOSXWatchService.scala:61:25: type mismatch;
[error]  found   : () => Unit
[error]  required: Runnable
[error]     executor.submit((() => {
[error]                         ^
Ethan Atkins
Add MacOSXWatchService
This watch service is taken from my CloseWatch plugin, found at
https://github.com/swoval/swoval

It uses a native jni library, provided by apple-file-events, to receive
file events from the os. I more or less copied this file from the close
watch source code with some minor modifications given that it is now in
the sbt.io package.

@eatkins eatkins force-pushed the eatkins:osx-watch branch from 434f1b6 to b7e7cc2 Mar 29, 2018

@eatkins

This comment has been minimized.

Copy link
Contributor Author

commented Mar 29, 2018

I made the file 2.10 compatible, but, out of curiosity, why do we build for 2.10 (and 2.11)? Isn't this module only used by sbt 1.x?

@eed3si9n

This comment has been minimized.

Copy link
Member

commented Mar 29, 2018

I made the file 2.10 compatible, but, out of curiosity, why do we build for 2.10 (and 2.11)? Isn't this module only used by sbt 1.x?

We first split out IO as an aspirational general-purpose IO module while we were still in 0.13, and built other things on top of that. At some point we might drop 2.10.

@eed3si9n eed3si9n requested a review from dwijnand Apr 3, 2018

@dwijnand
Copy link
Member

left a comment

thanks @eatkins

@dwijnand dwijnand merged commit fbd1d48 into sbt:1.1.x Apr 3, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@dwijnand dwijnand removed the ready label Apr 3, 2018

@dwijnand dwijnand added this to the 1.1.5 milestone Apr 3, 2018

@eatkins eatkins deleted the eatkins:osx-watch branch Oct 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.