Spawning multiple processes that block, and returning to the command prompt. Task to 'start' and 'stop' "session"

(Luke Patterson) #1

Hi. I’m a new Gradle user, it is fantastic, thanks.

I am trying to get some IDE-like assistance with auto-generation, but without the IDE. I want to use a text-editor, and not require that it have a plugin/macro/script to kick-off generation commands.

I want tell Gradle to “watch” some files and generate some other files when something changes. Specifically, I want to wrap Sass’ and CoffeeScript’s “watch” commands. One of the problems is that they both block.

Ideally, I could say “gradle start-watching” and it would spawn something, and then return to the command prompt. Later, I could say “gradle stop-watching”.

If someone could send some hints and/or URLs in my general direction, that would be appreciated. I’m hoping that I can leach off someone else’s hard work. I’m reading about the daemon now, I’m guessing that it is part of the solution.

Thanks, Luke

(Justin Ryan) #2

Another model for this is how sbt can monitor files for changes and do its incremental build.

(Luke Daley) #3

There’s no real support for this kind of thing right now. You’d have to do this yourself by writing a watching daemon and managing the starting/stopping with the ant java task.

(Luke Patterson) #4

Thanks, Luke! Now I just need to find a way to serialize (and store in a file location that Gradle API hands to me) the process descriptor on the “start-watching” task, so that my “stop-watching” tasks kills the right process(es). Thanks - Luke