Build Script in D

evilrat evilrat666 at gmail.com
Fri Jan 11 04:47:55 PST 2013


On Friday, 11 January 2013 at 08:36:11 UTC, Manipulator wrote:
> A class like this in Phobos would make it a lot easier for
> newcomers. :-)

maybe, but that version is a bit... cryptic.

i think it should be ultra easy to use, but this script is more 
like python scons(yeah, maybe i'm too stupid to use it properly)

i would love to see something like this:

import std.builder;

void main(string[] argv)
{
/*
get builder with only home path where to build stuff. assuming 
compiler to be the same as current compiler and the same 
target(32 bit or 64 bit, release or debug)

also something like this for custom target:
auto builder = Builder( homepath!"./", arch!"x86", mode!"debug" )

pseudo signature: _struct_ Builder(vararg ...)
*/
auto builder = Builder( homepath("path_to_debug_location", 
"path_to_release")() )()

// assuming all methods returns ref to self so it could be just 
simple calls
builder.addSrcPath("path_to_src_folder_1");
// or can be chained
builder.addSrcPath("path_to_src_folder_2").
   addSrcPath("path_to_src_folder3");

builder.addImportPath("path_to_imports");
builder.addLinkLib("somelib.a");

// etc...

// compiler log
string log = builder.build();

// target path, i.e. "/users/me/coolstuff/bin/prog1"
string productpath = builder.product();

writefln( "%s build %s", productpath, builder.success? "complete" 
: "failed!" );

...

}


also to all above it would be good if there be some concept of 
multiple targets or jobs and ordering, to allow build stuff 
dependent on other stuff in one run


More information about the Digitalmars-d-announce mailing list