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: 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.


Jan



>-----Urspr√ľngliche Nachricht-----
>Von: Michael George [mailto:mdgeorge@cs.cornell.edu] 
>Gesendet: Freitag, 17. Juli 2009 04:45
>An: user@ant.apache.org
>Betreff: a task for selecting among possible options?
>
>Hello,
>
>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>
></choice>
>
>To mean "set foo to the first of env.FOO, ${basedir}/foo, and 
>/usr/*/foo 
>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 
>configuration 
>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?
>
>Thanks!
>
>--Mike
>
>---------------------------------------------------------------------
>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