ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick_Giana...@sybari.com
Subject Re: Embedded Properties
Date Tue, 13 Apr 2004 19:16:00 GMT
Thanks Stefan.
I considered using separate files, but that would make a mess for my 
intent.
In a subsequent e-mail you mention that the <macrodef> task can eliminate 
the need for an external task (<propertycopy> in this case).  But in your 
description below, you reference <propertycopy> as a follow-up to 
<macrodef>.  Am I misunderstanding?

Regards,
Nick G.





Stefan Bodewig <bodewig@apache.org>
04/13/2004 11:15 AM
Please respond to "Ant Users List"
 
        To:     user@ant.apache.org
        cc: 
        Subject:        Re: Embedded Properties


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




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


Mime
View raw message