<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:[email protected]]
>Gesendet: Freitag, 17. Juli 2009 04:45
>An: [email protected]
>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: [email protected]
>For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]