Boost logo

Boost-Build :

From: Phillip Seaver (phil_at_[hidden])
Date: 2006-10-04 14:48:21


Olivier,

See if this works for you. You had $(<) instead of $(>) for your
sources -- I always get confused on which is which. I also changed it
to define generated-targets instead of run and for the
generators.register call, you had cvs.main instead of cvs.run.

Phillip

Olivier Smeesters wrote, on 10/4/2006 3:05 AM:
> Hi Phillip,
>
> It was indeed inspired from that example and from the notfile rule. My
> problem is that the itrace example does not show how it invokes the
> tool, how it gets the file names.
>
> If you can help me there, I would be very interested.
>
> Thanks,
>
>
> Olivier
>
>
>> Date: Tue, 03 Oct 2006 11:00:43 -0400
>> From: Phillip Seaver <phil_at_[hidden]>
>> Subject: Re: [Boost-build] Integrating source control in boost.build
>> To: "Boost.Build developer's and user's list"
>> <boost-build_at_[hidden]>
>> Message-ID: <45227B1B.1000503_at_[hidden]>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>
>> It looks like you might want something more like the itrace example:
>> http://www.boost.org/doc/html/bbv2/extending/tools.html#id2859013
>>
>> Phillip
>>
>>
>> Olivier Smeesters wrote, on 9/26/2006 7:22 AM:
>>
>>> > 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
>>>
>>
>>
>>
>
>

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 generated-targets ( sources + : property-set : project name ? )
    {
        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) ;
                }
            }
        }

        local target = [ new notfile-target $(name) : $(project)
                        : [ new action $(leaves) : $(self.id) : $(property-set) ] ] ;
                
        return [ virtual-target.register $(target) ] ;
    }
}

generators.register [ new cvs-generator cvs.run : : 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