ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Bacon <jba...@magmic.com>
Subject Re: recursive expansion of property names
Date Fri, 25 Jun 2004 14:16:13 GMT
<!-- none of these resolve as ${env.WHATEVER} -->
<property environment="env" />

-- assuming macrodef works as advertised (which I have checked without 
the custom property handler) then this should resolve (it's in a 
macrodef with 'file' as an attribute so I actually use @{file})

<property file="${basedir}/${file}" />

--
Jeffrey Bacon
jbacon@magmic.com
Creative Developer
http://www.magmic.com

Wascally Wabbit wrote:
> At 07:32 PM 6/24/2004, you wrote:
>  >sorry, I copied the line from a macro and forgot to modify the @.
>  >
>  >Your example (first one) doesn't load properties from a file nor import
>  >the environment variables.  Are they handled differently?
> 
> You'd have too look at <property>'s implementation but wrt. the custom
> PropertyHelper I would not think it makes little difference (not checked).
> If you're passing all the "sets" and the "gets" through to the original
> helper (Ants) you should be ok.
> 
> What is the sample you wanted to show didn't work? The original you
> posted was wrong.
> 
> 
>  >In example two, it should resolve as follows (if everything worked 
> correctly):
>  >
>  >${${_ant}${_dot}${_file}}
>  >${ant${_dot}${_file}}
>  >${ant.${_file}}
>  >${ant.file}
>  >
>  >ant print:
>  >'ant.file(1)': ${ant.file}
>  >
>  >because ${ant.file} is not defined.
>  >
>  >if you added the definition:
>  >   <property name="ant.file" value="ant.file" />
>  >
>  >then it would resolve ${ant.file} and print:
>  >'ant.file(1)': ant.file
> 
> This is still wrong isn't it? I wanted it to resolve to the value
> of the 'ant.file' property (which the Ant runtime already auto-installs).
> But this is a side-issue...you'll have to ping the original author
> of the recursive algo for whether my sample makes sense...
> 
> 
>  >--
>  >Jeffrey Bacon
>  >jbacon@magmic.com
>  >Creative Developer
>  >http://www.magmic.com
>  >
>  >
>  >Wascally Wabbit wrote:
>  >>A typo? I don't think normal property expansion recognizes
>  >>the '@'; that token is reserved for use inside macros...no?
>  >>This works fine for me:
>  >>   <property name="afN" value=".file"/>
>  >>   <echo message="'ant.file(0)': ${ant${afN}}"/>
>  >>This does not work (the recursive code doesn't handle it):
>  >>     <property name="_dot" value ="."/>
>  >>     <property name="_ant" value="ant"/>
>  >>     <property name="_file" value="file"/>
>  >>     <echo message="'ant.file(1)': ${${_ant}${_dot}${_file}}"/>
>  >>At 06:34 PM 6/24/2004, you wrote:
>  >>
>  >>>well that's better.  It resolves the ${basedir} now but won't resolve
>  >>>properties defined as so:
>  >>>
>  >>>   <property environment="env" />
>  >>>   <property file="${basedir}/@{file}" />
>  >>>
>  >>>--
>  >>>Jeffrey Bacon
>  >>>jbacon@magmic.com
>  >>>Creative Developer
>  >>>http://www.magmic.com
>  >>>
>  >>>[[ snip ]]
>  >>
>  >>The Wabbit
> 
> The Wabbit
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

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


Mime
View raw message