Bloop: Add restarting mode to `bloop run --watch`

Created on 21 Jun 2018  路  9Comments  路  Source: scalacenter/bloop

Currently, bloop run --watch only works for self-terminating apps so that it's not applicable for non-terminating apps such as servers.

What about adding an option to kill the forked vm and restart it when a source file change is detected? This feature would be drop-in replacement of https://github.com/spray/sbt-revolver.

community feature task / run

Most helpful comment

btw this can be worked around with some tools :) http://eradman.com/entrproject/

fd scala | entr -r bloop run ...

All 9 comments

Thanks for opening this ticket Jisco. I agree this is valuable and would love to see it available in a release soon. Feel free to give it a try, I don't think the changes will be big because we already support cancellation of forked processes via Monix.

Is it? You didn't specify that your application was still running and you were expecting bloop to kill the JVM and restart it. If it is, let's close #475 in favor of this ticket that is clearer about the goal and more actionable.

btw this can be worked around with some tools :) http://eradman.com/entrproject/

fd scala | entr -r bloop run ...

Nice :smile:

I'd like to implement this for the CLI at some point too, but if I can avoid developing/maintaining it the better. Thanks for sharing that incantation!

On the IDE side (Metals/IntelliJ), a way to emulate the behavior expected in the ticket is to have the build clients send a BSP buildTarget/run request to a file whenever there are are changes in a file in the editor.

Bloop starts up quickly (thanks for that!), so using entr for this is actually quite ok usability-wise.

Also, the Unix philosophy.. :)

The only downside of the entr workaround is that whenever you add new a new source file, it won't be watched. So native support of killing daemons will work a little better.

@svalaskevicius big thanks for this solution.

+1 for this issue, without it there's no way to iterate fast with server development.

@dkovalenko if you need to iterate that fast, maybe you should write a test instead of starting an entire server ;)

On a more serious note (or is it?), I'd also appreciate this feature.

Was this page helpful?
0 / 5 - 0 ratings