bloop icon indicating copy to clipboard operation
bloop copied to clipboard

Add restarting mode to `bloop run --watch`

Open guersam opened this issue 6 years ago • 10 comments

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.

guersam avatar Jun 21 '18 14:06 guersam

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.

jvican avatar Jun 21 '18 14:06 jvican

This is a duplicate of https://github.com/scalacenter/bloop/issues/475.

tindzk avatar Jun 21 '18 17:06 tindzk

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.

jvican avatar Jun 21 '18 18:06 jvican

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

fd scala | entr -r bloop run ...

svalaskevicius avatar Sep 14 '19 17:09 svalaskevicius

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.

jvican avatar Sep 14 '19 17:09 jvican

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

Also, the Unix philosophy.. :)

svalaskevicius avatar Sep 14 '19 18:09 svalaskevicius

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.

davojan avatar Oct 14 '19 11:10 davojan

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

dkovalenko avatar Jul 28 '20 14:07 dkovalenko

@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.

kubukoz avatar Sep 01 '20 15:09 kubukoz