ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Dereferencing property files
Date Fri, 04 Dec 2009 08:54:48 GMT
AFAIK this AC:task is available for Ant earlier 1.6.

With Core: I am not up to date with all the property evaluators now in core.
You could plugin your own evaluator and do something like ${myown:name}, so maybe a
${nested:atk-${atk.version}.exported.base.dir} would be possible. Or more nested

${nested:atk-${nested:${propname}}.exported.base.dir}
propname=atk-version
atk-version=1.26.0


Oh yes: just released the 'props' antlib from the sandbox
http://ant.apache.org/antlibs/props/index.html

    <propertyhelper>
      <props:nested />
    </propertyhelper>
    <property name="foo" value="foo.value" />
    <property name="var" value="foo" />
    <echo> ${${var}} = foo.value </echo>


I updated the FAQ in SVN with that.


Jan

>-----Urspr√ľngliche Nachricht-----
>Von: Dalton, Tom [mailto:tdalton@hp.com] 
>Gesendet: Donnerstag, 3. Dezember 2009 18:03
>An: Ant Users List
>Betreff: RE: Dereferencing property files
>
>As a quick note, the FAQ should probably say:
>
>How can I do something like <property name="prop" 
>value="${${anotherprop}}"/> (double expanding the property)?
>BEFORE ANT 1.6, you can not.
>
>I'm very sorry but my work's network arrangements are such 
>that I cannot easily submit a patch for the FAQ file, else I would.
>
>Thanks again,
>
>Tom
>
>-----Original Message-----
>From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
>Sent: 03 December 2009 12:49
>To: user@ant.apache.org
>Subject: AW: Dereferencing property files
>
>Do you mean this: 
>http://ant.apache.org/faq.html#propertyvalue-as-name-for-property ?
>
>Jan 
>
>>-----Urspr√ľngliche Nachricht-----
>>Von: Dalton, Tom [mailto:tdalton@hp.com]
>>Gesendet: Donnerstag, 3. Dezember 2009 10:39
>>An: Ant Users List
>>Betreff: RE: Dereferencing property files
>>
>>Should I assume that this is impossible in Ant? This seems 
>like a major 
>>limitation...
>>
>>Tom
>>
>>-----Original Message-----
>>From: Dalton, Tom
>>Sent: 01 December 2009 12:05
>>To: user@ant.apache.org
>>Subject: Dereferencing property files
>>
>>Hi,
>>
>>I have a property file with an entries like:
>>atk-1.26.0.exported.base.dir=/path/to/atk/1.26.0
>>atk-1.27.0.exported.base.dir=/path/to/atk/1.27.0
>>
>>In my build file I want to be able to refer to this property with a 
>>version-independent name like "atk.base.dir"
>>
>>I load the property file, to get the properties 
>>"atk-1.2x.0.exported.base.dir"
>>I set another property "atk.version" to a value of "1.26.0"
>>
>>How do I combine these to get the new property "atk.base.dir".
>>
>>E.g. I want to double dereference a property:
>>
>><loadproperties srcFile="/path/to/my/atk/exported.properties"/>
>><echo>atk-1.26.0.exported.base.dir</echo><!-- works ok -->
>><echo>atk-1.27.0.exported.base.dir</echo><!-- works ok --> <property

>>name="atk.version" value="1.26.0"/> <property name="atk.base.dir"
>>value="${atk-${atk.version}.exported.base.dir}"<!-- doesn't work-->
>>
>>I tried to do it with
>><property name="atk.base.dir" 
>>refid="atk-${atk.version}.exported.base.dir"<!-- also doesn't
>>work--> But that doesn't work because the loaded property does
>>not have an id, only a name, so the refid lookup fails.
>>
>>I just want to set my external dependency versions in one place!
>>
>>It cannot be that hard!
>>
>>All help gratefully received!
>>
>>TOM DALTON
>>
>>
>>
>>---------------------------------------------------------------------
>>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
>>
>>
>
>---------------------------------------------------------------------
>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
>
>

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


Mime
View raw message