You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Todor Boev <t_...@prosyst.bg> on 2004/04/15 09:52:40 UTC
When is unless/if checked?
Hello all,
My question is when the unless/if conditions to execute a target are checked - only once at the beginning of the build or just prior to target execution? Seems to me that ant goes with the first option because the following:
<target name="condition_checker">
<property name="condition" value="true"/>
</target>
<target name="conditional" depends="condition_checker" unless="${condition}">
<echo message="Called with condition: ${condition}"/>
</target>
will output
[echo] Called with condition: true
which is somewhat unexpected because the "conditional" should not be executed when condition=true.
10x in advance for all replys.
Re: When is unless/if checked?
Posted by Peter Reilly <pe...@corvil.com>.
You need to do:
<target name="conditional" depends="condition_checker" unless="condition">
Peter
Todor Boev wrote:
>Hello all,
>My question is when the unless/if conditions to execute a target are checked - only once at the beginning of the build or just prior to target execution? Seems to me that ant goes with the first option because the following:
>
><target name="condition_checker">
> <property name="condition" value="true"/>
></target>
>
><target name="conditional" depends="condition_checker" unless="${condition}">
> <echo message="Called with condition: ${condition}"/>
></target>
>
>will output
>
>[echo] Called with condition: true
>
>which is somewhat unexpected because the "conditional" should not be executed when condition=true.
>
>10x in advance for all replys.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: When is unless/if checked?
Posted by Ivan Ivanov <ra...@yahoo.com>.
Zdravei Todore,
1) There is an error in your unless usage it should be
unless="condition" (yes, without ${}).
2) An ant property is said to be set if it contains
some value in it. In other words
<property name="condition" value="true"/>
is equivalent to
<property name="condition" value="false"/>
in both cases this property is set since it has a
value in it.
Dovizdane
Ivan Ivanov
--- Todor Boev <t_...@prosyst.bg> wrote:
> Hello all,
> My question is when the unless/if conditions to
> execute a target are checked - only once at the
> beginning of the build or just prior to target
> execution? Seems to me that ant goes with the first
> option because the following:
>
> <target name="condition_checker">
> <property name="condition" value="true"/>
> </target>
>
> <target name="conditional"
> depends="condition_checker" unless="${condition}">
> <echo message="Called with condition:
> ${condition}"/>
> </target>
>
> will output
>
> [echo] Called with condition: true
>
> which is somewhat unexpected because the
> "conditional" should not be executed when
> condition=true.
>
> 10x in advance for all replys.
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org