You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Nico Seessle <ni...@seessle.de> on 2000/09/17 23:55:41 UTC

Fw: Using "if" in a target?

----- Original Message -----
From: "Diane Holt" <ho...@yahoo.com>
To: <an...@jakarta.apache.org>
Sent: Sunday, September 17, 2000 11:35 PM
Subject: Re: Using "if" in a target?


> So "if" just checks to see if a property exists, not whether it's actually
> set to anything? And the fact that I pass a define for the p4client
> property, even though there's no value for it, makes that property "exist"
> for ant? So, is there no way to test whether a property actually has a
> value?
>

Should this be "fixed" in some way?

The following could be done
1. If -Dname= is passed to ant assume that the user don't want to set this
property (may break build-files)
2. Require the property specified for if=""/unless="" to contain one of the
"boolean-values" "yes", "on" or "true" (this will break build-files, at
least mine :-) )
3. Require the property specified for if=""/unless="" to contain anything
other than nothing (the empty string) (for if)  and dont't just check for
non-existence Or check for containing nothing or being non-existent (for
unless). (should not break so much; not mine and not ant's build-file). If
you use the available-task which seems the most common way to me the
property is set to "true" if you don't specify somethng else so this should
not be a problem.

Nico




Re: Fw: Using "if" in a target?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "NS" == Nico Seessle <ni...@seessle.de> writes:

 NS> The following could be done 

 NS> 1. If -Dname= is passed to ant assume that the user don't want to
 NS> set this property (may break build-files) 

No way. I don't know of anybody relying on this, but no. Defining
something to not define anything doesn't feel right.

 NS> 2. Require the property specified for if=""/unless="" to contain
 NS> one of the "boolean-values" "yes", "on" or "true".

This would make the new value attribute of <available> less useful,
so no (or -1 in Apache speak).

 NS> 3. Require the property specified for if=""/unless="" to contain
 NS> anything other than nothing (the empty string)

Don't like it too much either. But if this was something that was
widely regarded as useful, I wouldn't veto it.

Stefan