Boost logo

Boost-Build :

From: David Abrahams (dave_at_[hidden])
Date: 2005-06-16 07:17:24


Vladimir Prus <ghost_at_[hidden]> writes:

> On Thursday 16 June 2005 14:53, David Abrahams wrote:
>
>> > Hmm... did you try something like:
>> >
>> > local c = [ project.current ]
>> > local project-module = [ $(c).project-module ]
>> > module $(project-module)
>> > {
>> > # Declare everything you want.
>> > }
>> >
>> > That would be equivalent to putting the code in "{}" right in invoking
>> > Jamfile.
>>
>> Of course I didn't :)
>> How would I know to do something like that?
>
> Well... the only way to make the rule ask exactly as if the code is in Jamfile
> is to change to the Jamfiles's module.
>
>>
>> Do you think that's an appropriate strategy for the world-at-large,
>> and not just the cogniscenti?
>
> I think it's fine.

Wouldn't

module [ execute-in-jamfile ]
{
...
}

be a little better?

> The only other approach I see is to allow the user to
> specify, for each rule in Jamfile, if it should be inherited by child project
> localized (so that it work in context of Jamfile without any effort), or not.

Or there could be a way to tell the system that a particular rule in a
module ought to be localized whenever that module is imported:

rule build-local-docs ( )
{
...
}

jamfile-utility build-local-docs ;

> They used to be inherited localized at some point, but then it leads to
> strange behaviour. Consider:
>
> .something = .... ;
>
> rule helper ( )
> {
> ... use .something ...
> }
>
> Then each child Jamfile will get a localized version of .helper, that will
> look for .something in that Jamfile, not in the Jamfile that defines the
> rule.

Yep, I understand the problem.

> Probably can be helped with the constant rule, but still I found it more
> logical to inherit rules non-localized.

I agree. I think it should be selectable on a rule-by-rule basis,
and not by inheritance. I don't think that's really relevant in this
case anyway; the original rule is not defined in a Jamfile.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com
 

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