digitalmars.D.announce - Reloaded for dub
- Kingsley (12/12) Feb 20 2015 Hi
- Martin Nowak (3/6) Feb 20 2015 Nice, want to contribute?
- FG (8/9) Feb 20 2015 I see two problems:
- Rikki Cattermole (2/14) Feb 20 2015 *whistles* https://github.com/rikkimax/livereload
- qznc (7/18) Feb 22 2015 You seem to especially target Vibe.d and your approach is based
Hi Just thought I would share this in case anyone else finds it useful. I wrote a tiny utility that detects changes to D files and then rebuilds and re-executes the main binary using dub. I use for developing with vibe.d and other dub D project that have an executable binary. The code is here: https://github.com/kingsleyh/reloaded essentially you just run dub in the root and it builds the reloaded binary. Then you just copy that binary to the root of your dub project and ./reloaded and then as soon as you make a change to a D file your code will be built and executed. --K
Feb 20 2015
On 02/20/2015 03:00 PM, Kingsley wrote:I use for developing with vibe.d and other dub D project that have an executable binary. The code is here: https://github.com/kingsleyh/reloadedNice, want to contribute? https://github.com/D-Programming-Language/dub/issues/446
Feb 20 2015
On 2015-02-20 at 15:00, Kingsley wrote:Just thought I would share this in case anyone else finds it useful. I wrote a tiny utility that detects changes to D files and then rebuilds and re-executes the main binary using dub.I see two problems: 1. It doesn't sleep for a few seconds after detecting that a file has changed, so when you upload several changed source files, recompilation may start before all of them are updated and either fail or produce something strange. 2. It works like this: if (changed) { kill(projectName); build() && run(projectName); sleep(); } As a result, if the compilation fails, no application will be running. Probably a better approach would be to have the application copied to a different place and run from there. Then the loop would look like this (I also added an extra unittest run before the running application is replaced): if (changed) { sleep(); build() && test() && kill(dest) && copy(projectName, dest) && run(dest); sleep(); } In this approach your program is almost always running. You only have to figure out how to provide `dest`. Perhaps via command line arguments where you provide a path (or just a directory).
Feb 20 2015
On 21/02/2015 3:00 a.m., Kingsley wrote:Hi Just thought I would share this in case anyone else finds it useful. I wrote a tiny utility that detects changes to D files and then rebuilds and re-executes the main binary using dub. I use for developing with vibe.d and other dub D project that have an executable binary. The code is here: https://github.com/kingsleyh/reloaded essentially you just run dub in the root and it builds the reloaded binary. Then you just copy that binary to the root of your dub project and ./reloaded and then as soon as you make a change to a D file your code will be built and executed. --K*whistles* https://github.com/rikkimax/livereload
Feb 20 2015
On Friday, 20 February 2015 at 14:00:33 UTC, Kingsley wrote:Hi Just thought I would share this in case anyone else finds it useful. I wrote a tiny utility that detects changes to D files and then rebuilds and re-executes the main binary using dub. I use for developing with vibe.d and other dub D project that have an executable binary. The code is here: https://github.com/kingsleyh/reloaded essentially you just run dub in the root and it builds the reloaded binary. Then you just copy that binary to the root of your dub project and ./reloaded and then as soon as you make a change to a D file your code will be built and executed.You seem to especially target Vibe.d and your approach is based on *restarting* the server. It should be possible to do even better. Reload the server without stopping. Basic idea: Compile your server application as a shared library. Run a small wrapper, which uses the shared library. If a file changes, recompile the library and load it into the wrapper.
Feb 22 2015