ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Kamienski <>
Subject target: if/unless w/ multiple properties?
Date Fri, 25 May 2001 22:18:47 GMT

I could not find anything in the documentation about testing 
multiple properties in a target element's if/unless attribute.
The only way I can come up with is to use multiple targets with
ifs or to use the if and the unless together...

For (prop1 && prop2), the simplest that I could come up with was 
something like:

  <target name="AND" depends="!prop2" if="prop1" unless="!prop2">
    <echo message="PROP1 &amp;&amp; PROP2"/>

  <target name="!prop2" unless="prop2">
    <property name="!prop2" value="whocares"/>

And for (prop1 || prop2), I came up with:

  <target name="OR" depends="prop1-or-prop2" if="prop1-or-prop2">
    <echo message="PROP1 || PROP2"/>

  <target name="prop1-or-prop2" depends="check-prop2" if="prop1">
    <property name="prop1-or-prop2" value="whocares"/>
  <target name="check-prop2" if="prop2">
    <property name="prop1-or-prop2" value="whocares"/>

What is the suggested method for implementing what amounts to
simple boolean expressions (e.g., if this-or-that or if this-and-that)?
Isn't there any easier way?



Aaron Kamienski <>
SNAP2 Corporation

View raw message