ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: a task for selecting among possible options?
Date Tue, 21 Jul 2009 06:45:38 GMT
<available property="foo" file="foo.txt" value="foo.txt"/> 
<available property="foo" file="${env.FOO}" value="${env.FOO}/>
... more available tasks

Because properties are immutable the first hit wins.


>-----Urspr√ľngliche Nachricht-----
>Von: Michael George [] 
>Gesendet: Freitag, 17. Juli 2009 04:45
>Betreff: a task for selecting among possible options?
>I'm trying to clean up our build process, and one of the problems is 
>that everyone on the team uses a different configuration mechanism 
>(environment vars, properties files, manual config,...).  In trying to 
>be backwards compatible with everyone's process I find I would like a 
>task that sets a property by selecting the first valid item 
>from a list 
>of possibilities.  For example, I'd like to able to write 
>something like
><choice property="foo">
>  <condition> <available file="@{}/foo.txt" /> </condition>
>  <option value="${env.FOO}" />
>  <option value="${basedir}/foo" />
>  <option>
>    <dirset dir="/usr" includes="**/foo*"/>
>    </option>
>To mean "set foo to the first of env.FOO, ${basedir}/foo, and 
>that contains the file foo.txt."  I'd also like to perhaps have the 
>option of prompting the user if multiple valid choices are found (for 
>example, with select="first" or select="prompt").
>Does anyone know of any tasks that would make this kind of 
>easy, before I dive in and try to write one myself?  If not, would 
>people find this useful if I code it up and submit it to ant-contrib?
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message