www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Automated rebuilding on program startup: tools.remake

reply downs <default_357-line yahoo.de> writes:
I just committed tools/remake.d. What it does in a nutshell is this:

it lets you add a call in your main.d file, along the lines of

  checkRemake(args, "path/to/source/file.d");

checkRemake invokes gdc (or a compiler of choice, via string Compiler), in
verbose mode, to generate a list of imports, then filters out Phobos files
(that part could probably use some work). Then it checks each of those files to
see if they're newer than the corresponding obj/ file, and if yes, rebuilds
them.

Finally, if any object files were rebuilt, it links a new binary, calls the
destructors, and invokes it.

Designed to run on Unix-based systems, you might find it useful for developing
server-side scripts in D, as it lets you just edit a webpage's D source and
reload in the browser to trigger an incremental rebuild.

Thoughts?

PS: source http://svn.dsource.org/projects/scrapple/trunk/tools/tools/remake.d
Apr 21 2009
parent reply "Saaa" <empty needmail.com> writes:
Instead of running build/bud you could run your old program to rebuild 
itself?

I just committed tools/remake.d. What it does in a nutshell is this:

 it lets you add a call in your main.d file, along the lines of

  checkRemake(args, "path/to/source/file.d");

 checkRemake invokes gdc (or a compiler of choice, via string Compiler), in 
 verbose mode, to generate a list of imports, then filters out Phobos files 
 (that part could probably use some work). Then it checks each of those 
 files to see if they're newer than the corresponding obj/ file, and if 
 yes, rebuilds them.

 Finally, if any object files were rebuilt, it links a new binary, calls 
 the destructors, and invokes it.

 Designed to run on Unix-based systems, you might find it useful for 
 developing server-side scripts in D, as it lets you just edit a webpage's 
 D source and reload in the browser to trigger an incremental rebuild.

 Thoughts?

 PS: source 
 http://svn.dsource.org/projects/scrapple/trunk/tools/tools/remake.d 

Apr 21 2009
parent downs <default_357-line yahoo.de> writes:
Saaa wrote:
 Instead of running build/bud you could run your old program to rebuild 
 itself?
 

That's the idea! :)
 I just committed tools/remake.d. What it does in a nutshell is this:

 it lets you add a call in your main.d file, along the lines of

  checkRemake(args, "path/to/source/file.d");

 checkRemake invokes gdc (or a compiler of choice, via string Compiler), in 
 verbose mode, to generate a list of imports, then filters out Phobos files 
 (that part could probably use some work). Then it checks each of those 
 files to see if they're newer than the corresponding obj/ file, and if 
 yes, rebuilds them.

 Finally, if any object files were rebuilt, it links a new binary, calls 
 the destructors, and invokes it.

 Designed to run on Unix-based systems, you might find it useful for 
 developing server-side scripts in D, as it lets you just edit a webpage's 
 D source and reload in the browser to trigger an incremental rebuild.

 Thoughts?

 PS: source 
 http://svn.dsource.org/projects/scrapple/trunk/tools/tools/remake.d 


Apr 21 2009