ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay Walters <jwalt...@netnumina.com>
Subject RE: Expanding ${} constructs for all attributes
Date Thu, 14 Dec 2000 04:00:52 GMT
Something like the following inserted into the documentation in the section
where you already speak about targets and if/unless would have been very
helpful to me in using Ant.

===========

Sometimes there is a need to perform conditional processing based on a
property which can take multiple values.  The pattern to use when dealing
with this circumstance is to create a new property, the name of which is
created from the value of the original property.  An example of this is
shown below.  In this example we have a property "X" which can have the
values "A" or "B".  We will create a new property named "X.A" or "X.B"
depending on the value of "X".  We can then create our targets using the if
attribute and the various new properties.

<target ...>
    <property name="X.${X}" value="true"/>
</target> 

<target ... if="X.A" ...>
   ...
</target>

<target ... if="X.B" ...>
   ...
</target>

=========

Feel free to improve upon this as needed, but I think it'll help the next
new person if something like this gets added to the docs.

Cheers
Jay Walters

Mime
View raw message