ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Embedded Properties
Date Tue, 13 Apr 2004 15:15:45 GMT
On Tue, 13 Apr 2004, Nick Gianakas <Nick_Gianakas@sybari.com> wrote:

> <property name="Lib.Name.Static" value="foo" />
> <property name="Lib.Name.Dynamic" value="bar" />
> <property name="Lib.Name" value="${Lib.Name.${Type}}" />

That won't work. Some alternatives:

* Use the Ant idiom of putting things like these into property files.

  I.e.
  
  Static.properties:
  Lib.Name=foo
  
  Dynamic.properties:
  Lib.Name=bar

  <property file="${Type}.properties/>

* use ant-contrib's <propertycopy>[1]

* fake <propertycopy> with <macrodef>

  <macrodef name="propertycopy">
    <attribute name="name"/>
    <attribute name="from"/>
    <sequential>
      <property name="@{name}" value="${@{from}}"/>
    </sequential>
  </macrodef>

The last two would then use

  <propertycopy name="Lib.Name" from="Lib.Name.${Type}"/>

Stefan

Footnotes: 
[1]  http://ant-contrib.sf.net/


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


Mime
View raw message