You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Reuleaux, Andreas" <A....@klopotek.de> on 2000/09/15 21:41:02 UTC
targets depending on the value of a property
Hi ants,
can I make a decision whether to do one target or another
depending on the value of a property like this:
<target name="a">
<echo message="hi from a" />
</target>
<target name="b">
<echo message="hi from b" />
</target>
<target name="say-hi">
do either target a or target b depending on the value of the property
from
...do all the rest of say-hi
</target>
calling ant with
>ant say-hi -Dfrom=a
should do target a before the rest of say-hi, whereas
>ant say-hi -Dfrom=b
should do target b before the rest of say-hi
something like
<target name="a" if="from">
<echo message="hi from a" />
</target>
is not really of use to, since it only asks whether from
is set at all, not what its value is.
something like if="from==a" is needed instead.
Thanks for any help in advance.
--
Andreas
Re: targets depending on the value of a property
Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "RA" == Reuleaux, Andreas <A....@klopotek.de> writes:
RA> Hi ants, can I make a decision whether to do one target or
RA> another depending on the value of a property like this:
You can't, decissions are only made depending on the existance of a
property.
How does this property you want to decide upon get its value? Maybe
you can rewrite this to use the set/not set logic Ant employs?
Stefan