Targets with the same name

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Targets with the same name

Vladimir Prus

Hello!

In V2, we have a rule that if two targets with the same name are defined in
Jamfile, they are considered "alternatives" for the same target. There's an
algorithm to select, for a given build request, on of the alternatives.

The problem is that we don't have a way to declare to independents target that
produce file with the same name. Say, I want to produce main.foo and
main.bar. If I write:

   foo main : main.src ;
   bar main : main.src ;

V2 will think those are alternatives for the same target, and will complain.
If I change the name for any of the target, say:

   foo main : main.src ;
   bar main.bar : main.src ;

I'll get "main.bar.bar", not "main.bar".

I see two ways to solve the problem:

1. Automatically strip the suffix from main target name, when determining
basename of generated targets. So, it's possible to use:

  foo main.first : main.src ;
  foo main.second : main.src ;

and ".first"/".second" suffixes will be used only to resolve the ambiguity,
they won't affect the names of generated targets.

2. Allow to explicitly specify the basename of the generated target via some
feature, say, "<name>". So, user would have to write:

  foo main.first : main.src : <name>main ;
  foo main.second : main.src : <name>main ;

At the moment, I favour the first approach since it's easier for the user.
Anybody can comment, or offer any other idea?

- Volodya


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Targets with the same name

Deane Yang
Vladimir Prus wrote:

>
> I see two ways to solve the problem:
>
> 1. Automatically strip the suffix from main target name, when determining
> basename of generated targets. So, it's possible to use:
>
>   foo main.first : main.src ;
>   foo main.second : main.src ;
>
> and ".first"/".second" suffixes will be used only to resolve the ambiguity,
> they won't affect the names of generated targets.
>
> 2. Allow to explicitly specify the basename of the generated target via some
> feature, say, "<name>". So, user would have to write:
>
>   foo main.first : main.src : <name>main ;
>   foo main.second : main.src : <name>main ;
>
> At the moment, I favour the first approach since it's easier for the user.
> Anybody can comment, or offer any other idea?
>

First comment: Yes!
Second comment: Either way suits me with a slight preference for the first.
Third comment: How hard would it be to implement both?

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Targets with the same name

Vladimir Prus
On Tuesday 07 February 2006 19:46, Deane Yang wrote:

> Vladimir Prus wrote:
> > I see two ways to solve the problem:
> >
> > 1. Automatically strip the suffix from main target name, when determining
> > basename of generated targets. So, it's possible to use:
> >
> >   foo main.first : main.src ;
> >   foo main.second : main.src ;
> >
> > and ".first"/".second" suffixes will be used only to resolve the
> > ambiguity, they won't affect the names of generated targets.
> >
> > 2. Allow to explicitly specify the basename of the generated target via
> > some feature, say, "<name>". So, user would have to write:
> >
> >   foo main.first : main.src : <name>main ;
> >   foo main.second : main.src : <name>main ;
> >
> > At the moment, I favour the first approach since it's easier for the
> > user. Anybody can comment, or offer any other idea?
>
> First comment: Yes!
> Second comment: Either way suits me with a slight preference for the first.

Good, the first alternative is implemented and comitted. I'll update docs
soon.

> Third comment: How hard would it be to implement both?

Pretty easy, I think. But I'd rather not implement a feature until I know the
use case for it. If you have one, speak out ;-)

- Volodya
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Targets with the same name

Deane Yang
Vladimir Prus wrote:

> On Tuesday 07 February 2006 19:46, Deane Yang wrote:
>> Vladimir Prus wrote:
>>> I see two ways to solve the problem:
>>>
>>> 1. Automatically strip the suffix from main target name, when determining
>>> basename of generated targets. So, it's possible to use:
>>>
>>>   foo main.first : main.src ;
>>>   foo main.second : main.src ;
>>>
>>> and ".first"/".second" suffixes will be used only to resolve the
>>> ambiguity, they won't affect the names of generated targets.
>>>
>>> 2. Allow to explicitly specify the basename of the generated target via
>>> some feature, say, "<name>". So, user would have to write:
>>>
>>>   foo main.first : main.src : <name>main ;
>>>   foo main.second : main.src : <name>main ;
>>>
> Good, the first alternative is implemented and comitted. I'll update docs
> soon.

Thank you!

>
>> Third comment: How hard would it be to implement both?
>
> Pretty easy, I think. But I'd rather not implement a feature until I know the
> use case for it. If you have one, speak out ;-)
>

Good point. I'll let you know if I run into a situation where the first
alternative doesn't work.

Deane

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build