ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject RE: A question about "available" and doing conditionals in a build xml file.
Date Wed, 17 May 2000 15:42:23 GMT
> -----Original Message-----
> From: Ken Wood []
> Sent: Thursday, 18 May 2000 0:53
> To:
> Subject: A question about "available" and doing conditionals in a build
> xml file.
> I don't seem to find much in the documentation
> on the use of properties set by 'available' to
> do conditional things in the ".xml" file.
> For example, while it's not in the documentation I've
> read, I see in the ant build.xml (browsing the repository...)
> that there is an 'exclude unless="xxx.present"' . Well, I never
> saw "unless" in any of the documentation....

Yes, this is not currently documented. Indeed, the ability to define
includes and excludes as nested elements rather than attributes is not
included in the documentation either. It often surprises people. Would you
like to submit a patch to the documentation :-)?

> I wanted to run a java application via the "java" task,
> conditional upon a property that checks to see
> if a file is present. So I tried adding "unless"
> in my call to the java task. Ant didn't like it.
> So, I guess my question becomes this - for which tasks
> is "unless" recognized? Is there a plan to add
> "unless" to all the tasks?

"unless" is part of the MatchingTask class and controls the inclusion or
exculsion of files from a directory scan. Thus it can control, for example,
which files in a directory will be included in a compile or which files will
be excluded from a jar file operation.

This facility is not intended to conditionally control the execution of ant

I am not aware of any plans to add "unless" attributes to other tasks.

> Is there some other way of doing conditionals within
> a build xml file? For example, I'm building a
> target to bundle up the files for a distribution,
> and on Unix I need to copy some "sh" files into
> the 'bin' directory, but on windows I need to
> copy some "bat" files into the bin directory.
> So, I want to have two copies, each conditional
> on the operating system...

Conditional execution of tasks is a topic of considerable debate on the ant
list. Many people have a strong desire to avoid creating within ant a new
programming language.


View raw message