|
Boost-Build : |
From: Olivier Smeesters (olivier.smeesters_at_[hidden])
Date: 2006-09-26 07:22:37
Hi All,
I'm trying to convert a previous build system, based on Ant, to
Boost.Build. One nice feature of this previous system was that it could
run cvs commands on the sources (eg. to find out if all files are
up-to-date or to tag all files that make a release). I'm trying to
reproduce this functionality.
The ultimate goal would be to create rule where items to be managed
under version control would be declared and, automatically, several main
targets would be created like "cvs-check", "cvs-update", "cvs-commit",
"cvs-tag".
As a first try, I wanted to create a generator which would allow me to
do something like this:
| exe foo : foo.c ;
| cvs commit : foo : <cvs-action>commit ;
And calling "bjam commit" would commit all the files used to build foo.
So I wrote the attached generator (derived from notfile).
But currently, I don't get any source file name although I checked with
an echo that $(leaves) is full of file-target objects in the run rule of
the generator. Nevertheless, I only get something like:
| cvs.run <l./gcc/debug/cvs-action-commit>commit
| Action: commit
| Sources: <l./gcc/debug/cvs-action-commit>commit
Any idea how I can get the file names in the cvs.run action ? or how I
should do that CVS thingy ?
Thanks in advance,
Olivier
-- Olivier Smeesters Embedded Software Engineer Newtec (LLN Office)
import generators ;
import type ;
import feature ;
import project ;
import targets ;
import toolset ;
import "class" : new ;
type.register CVS_MAIN ;
class cvs-generator : generator
{
rule __init__ ( * : * )
{
generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
generator.composing = true ;
}
rule run ( project name ? : property-set : sources * : multiple ? )
{
local leaves ;
for local s in $(sources)
{
local temp = [ virtual-target.traverse $(s) : : include-sources ] ;
for local t in $(temp)
{
if ! [ $(t).action ]
{
leaves += $(t) ;
}
}
}
return [ new notfile-target $(name) : $(project) :
[ new action $(leaves) : cvs.run : $(property-set) ]
] ;
}
}
generators.register [ new cvs-generator cvs.main : : CVS_MAIN ] ;
feature.feature cvs-action : check update commit : ;
toolset.flags cvs.run ACTION : <cvs-action> ;
actions cvs.run {
echo "Action: $(ACTION)" ;
echo "Sources: $(<)" ;
}
rule cvs ( target-name : sources * : requirements * : default-build * )
{
local project = [ project.current ] ;
targets.main-target-alternative
[ new typed-target $(target-name) : $(project) : CVS_MAIN
: [ targets.main-target-sources $(sources) : $(target-name) ]
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;
}
IMPORT $(__name__) : cvs : : cvs ;
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk