Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-02-13 05:05:32


Hi Mark,

> rule xml-sources-in ( sources * )
> {
> local xml-souces ;
> ...
> # What's the best jammer way here to cull the .xml sources?
> return $(xml-sources) ;
> }
> rule xlt-sources-in ( sources * )
> {
> local xlt-souces ;
> ...
> return $(xlt-sources) ;
> }
>
> rule gen-cpp ( targets * : sources * : properties * )
> {
> XML-SOURCES on $(targets) = [ xml-sources-in $(sources) ] ;
> XSLT-SOURCES on $(targets) = [ xslt-sources-in $(sources) ] ;
> # Experts: Is there a more direct jammer way to do the above that
> would # not require xml-sources-in and xslt-sources-in rules?
> SP on $(targets) = " " ;
> }

> Use similar approach for generating HTM type.
>
> Experts, did I miss anything? Would you have discriminated further
> upstream in the generator to automatically populate XML-SOURCES and
> XSLT-SOURCES for the actions block and obviate the need for all the noise
> above? (I anticipate a YES answer to that.)

Looking at Daniel's original code, it seems that only a single pair of "xml"
and "xslt" target is processed at once. And the only issue is how to make
sure that sources comes in specific order, so that inside action you know
that

   $(>[1])

is XML source, and

   $(>[2])

is XSL source. The only way I can think of is custom generator with the
following 'generated-targets' rule:

    rule generated-targets ( sources + : property-set : project name ? )
    {
        local xml ;
        local xsl ;
        for local s in $(sources)
        {
            if [ $(s).type ] = XML
            {
                xml += $(s) ;
            }
        }
        for local s in $(sources)
        {
            if [ $(s).type ] = XSLT
            {
                xsl += $(s) ;
            }
        }

        return [ generator.generated-targets $(xml) $(xsl)
            : $(property-set) : $(project) $(name) ] ;
    }

Not extra nice, and not better than what you've proposed, but that's how I did
it before. Maybe, we just need 'virtual-target.select-by-type' helper rule,
so that above can be rewritten as:

    rule generated-targets ( sources + : property-set : project name ? )
    {
        return [ generator.generated-targets
                    [ virtual-target.select-by-type XML : $(sources) ]
                    [ virtual-target.select-by-type XSLT : $(sources) ]
            : $(property-set) : $(project) $(name) ] ;
    }

Mark, Daniel, what do you think?

For reference, my test code is attached.

- Volodya

*****************************************************************************
** **
** WARNING: This email contains an attachment of a very suspicious type. **
** You are urged NOT to open this attachment unless you are absolutely **
** sure it is legitmate. Opening this attachment may cause irreparable **
** damage to your computer and your files. If you have any questions **
** about the validity of this message, PLEASE SEEK HELP BEFORE OPENING IT. **
** **
** This warning was added by the IU Computer Science Dept. mail scanner. **
*****************************************************************************




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