Ummm... sorry if I'm being terribly dim here, but...
<Target name="target" if="some.property"> ... </Target>
gets executed _if_ some.property is set, right?
<Target name="target" unless="some.property"> ... </Target>
gets executed _unless_ some.property is set, ie. if some.property is _not_
set, right?
So doesn't that make 'if' and 'unless' mutually exclusive???
BTW, in the src distro I have (a CVS checkout of about two weeks ago) the
Target class does not have 'if' or 'unless' properties, but has a
'condition' property, and the task gets executed if the property named in
the 'condition' attribute exists. Do I just have an old source distro? Or
is there some strange mapping done between 'if' and 'condition' to avoid
reserved words?
On Thu, 18 May 2000, Mariusz Nowostawski wrote:
>
> Glenn wrote:
>
> > The problem with using "unless" is that it implies that the property in
> > question must be set. �So
> > <target name="blah" unless="unless.property">
> > � ...
> > </target>
> > only works if you have set "unless.property" at some point. �How do I set
> > "couldnt.find.generated" (from discussion below) with available? �Can't do
> > it currently, as available only tests for positives, not negatives.
>
> What if available would set a property to "true" if true, and to
> "false" if resource/class/file is not available?
>
> > Personally, I'd like an ifnot attribute in the Target class that was
> > mutually exclusive to if. �
>
> That is what I was thinking, and that's what I like most.
>
> > [...]�Mariusz, you proposed below to replace
> > the "prop" attribute with "test," and "set" with "property." �Ok so far,
> > but what do you do with "unset"? �
>
> I agree. So in that case "set" and "unset" are fine, but it would be nice
> to rename "property" from "available" to "set" for consistency. But.. do
> we need them if we have "ifnot" on targets ;o) ?
>
>
> > At any rate, I'd be happy to do the "ifnot" patch for Target if anyone
> > wants it.
>
> +1
> I would like to have it a lot ;o)
>
> Actually I have exactly the same problem with idl generated files, and
> what I did is to regenerate java sources always after distclean - ugly,
> but with current Ant as it is there is no nice way for dealing with
> it. With "ifnot" this problem simply does not exist.
>
>
> Mariusz
>
>
--
Tom Cook - Software Engineer
"The brain is a wonderful organ. It starts functioning the moment you get
up in the morning, and does not stop until you get into the office."
- Robert Frost
LISAcorp - www.lisa.com.au
--------------------------------------------------
38 Greenhill Rd. Level 3, 228 Pitt Street
Wayville, SA, 5034 Sydney, NSW, 2000
Phone: +61 8 8272 1555 Phone: +61 2 9283 0877
Fax: +61 8 8271 1199 Fax: +61 2 9283 0866
--------------------------------------------------