build
build copied to clipboard
Automatically restart `build_runner watch` after `pub get` is exected
Hello!
Currently when using build_runner watch, the command will quit if a dependency change is detected.
This is understandable, but at the same time problematic.
The build_runner watch command is typically a command which we start once, and leave it running in the background without looking at it.
So if the command inadvertently stops, it's easy to forget to restart it, which can cause a bit of confusion.
It doesn't help that many times, the dependency change has no impact on the execution of build_runner. As it's likely a dependency added for the application, not a new generator or an analyzer/build_runner version change.
Would it be possible for the command to automatically restart itself when a dependency change is detected? Or alternatively, if that is technically challenging, could the exit be made optional?
More niche, but I think this could be extended to plugin compilation errors too.
While working on code generators, it's common that for a few seconds when making changes, one file in the sources of a plugin has an error. The error is only temporary and will be fixed soon. But this quits the watch mode. So the command has to be restarted after fixing it, which is a bit of a pain
I've ended up voluntarily not saving files as often as I'd like to, just to bypass this problem.
There is a hidden option --skip-build-script-check which should do what you want (just ignore build script changes)
Having it auto-restart by default would be nice though, and I actually thought we already supported this? The main entrypoint will just regenerate and re-run as long as the exit code is 75. Maybe we aren't setting that appropriately?