ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Gies <olivier.g...@bull.net>
Subject Re: Is recursive property evaluation supported?
Date Tue, 15 Apr 2008 02:02:56 GMT
-------- Original Message  --------
Subject: Is recursive property evaluation supported?
From: Shawn Castrianni <Shawn.Castrianni@halliburton.com>
To: 'Ant Users List' <user@ant.apache.org>
Date: 15/04/2008 07:12
> I was trying to present a list of choices for the user like an interactive textual menu.
 I produced the list of choices and set a property for each.  The user inputs a number corresponding
to the choice he wants, and I get the value corresponding to that choice via my properties
I set.  However, it doesn't work because I need to evaluate a recursive property expression:
>
> ${releaseName.${releaseName.selection}}
>
> where  ${releaseName.selection} would evaluate to the number they typed in [1, 2, 3...]
and then the outer property would be evaluated like ${releaseName.1} if they picked 1.
>
> Is this supported?  I was able to mix parameter evaluation inside property evaluation
and it worked fine:
>
> ${dllName.@{submodule}}<mailto:$%7bdllName.@%7bsubmodule%7d%7d>
>
> So I was surprised my recursive property evaluation didn't work.
>
> Any help presenting a list of choices to the user where they pick the number corresponding
to their choice would also be helpful.
>
> ---
> Shawn Castrianni
>
> ----------------------------------------------------------------------
> This e-mail, including any attached files, may contain confidential and privileged information
for the sole use of the intended recipient.  Any review, use, distribution, or disclosure
by others is strictly prohibited.  If you are not the intended recipient (or authorized to
receive information for the intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.
>   
To my knowledge, this is not supported. The fact that mixed ${ @{ } } 
works, is most likely due to the 2-time processing by the <macrodef> 
first, then by the main Ant property parser.

If you want to achieve the same purpose as a nested ${ ${} }, I suggest 
you use <propertycopy> from ant-contrib, like this:

<propertycopy property="newprop" 
from="releaseName.${releaseName.selection}" />

See ant-contrib documentation for more details.

BR,
Olivier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message