ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: AW: Need documentation change for if / unless
Date Tue, 05 Feb 2008 15:53:24 GMT
Mmm,
the manual states:
"""
A target also has the ability to perform its execution if (or unless)
a property has been set. This allows, for example, better control on
the building process depending on the state of the system (java
version, OS, command-line property defines, etc.). To make a target
sense this property, you should add the if (or unless) attribute with
the name of the property that the target should react to. Note: Ant
will only check whether the property has been set, the value doesn't
matter. A property set to the empty string is still an existing
property. For example:

    <target name="build-module-A" if="module-A-present"/>

    <target name="build-own-fake-module-A" unless="module-A-present"/>

In the first example, if the module-A-present property is set (to any
value, e.g. false), the target will be run. In the second example, if
the module-A-present property is set (again, to any value), the target
will not be run.

"""

I do not know how it could be more explicit.

Peter

On Feb 5, 2008 3:08 PM, Dean Schulze <dean_w_schulze@yahoo.com> wrote:
> Rainer,
>
> You couldn't be more wrong about the lack of documentation of the non-use of the ${}
notation in if / unless.
>
> The section about targets DOES NOT say that you don't use the ${} notation for if / unless.
 It does say this, however:
>
> 'This is done by placing the property name between "${" and "}" in the attribute value.'
>
> which leads you to believe that you need ${} notation wherever you need a property in
an attribute, such as in if / unless.
>
> How about helping your users out and making it clear that you don't use ${} notation
with if / unless, in marked contrast to everywhere else in Ant.
>
> Since if / unless are apparently the only place in Ant where you don't use ${} notation
that fact should also be pointed out explicitly so people don't forget the ${} notation elsewhere.
>
>
>
>
> Rainer Noack <rainer@noacks.net> wrote: Hi Dean,
>
> ${} refers to the value of a property.
> if / unless attributes refers to the existence (i.e. name) of a property.
>
> IMHO, the different notation is reasonable.
>
> However, this syntax and behaviour is pointed out explicitely in the manual:
> ->Using Ant->Targets
>
> Cheers
>
> Rainer
>
> -----Urspr√ľngliche Nachricht-----
> Von: Dean Schulze [mailto:dean_w_schulze@yahoo.com]
> Gesendet: Samstag, 2. Februar 2008 16:15
> An: dev@ant.apache.org
> Betreff: Need documentation change for if / unless
>
>
> I filed this bug regarding the use of the if and unless attributes of
>
> :
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=44315
>
> Matt Benson pointed out that the problem is that you don't use the ${}
> notation when naming a property in an if or unless attribute.  This is
> confusing because everywhere else in Ant when you reference a property you
> use the ${} notation.
>
> The documentation for Targets doesn't mention this:
>
> http://ant.apache.org/manual/using.html#targets
>
> The fact that you don't use ${} notation for the if / unless attributes
> needs be made explicit in the documentation.
>
> Are there any other places where you use a property without using the ${}
> notation?  If so these also need to be made explicit.  If the if / unless
> attributes are the only place where this applies that should also be noted
> in the documentation for if / unless.
>
> Thanks.
>
> Dean
>
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it
> now.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
>
>
> ---------------------------------
> Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message