From d08491a7dd26fb67c605a021015a8bf2c7770eaa Mon Sep 17 00:00:00 2001 From: Jan Materne Date: Fri, 14 Oct 2005 18:42:32 +0000 Subject: [PATCH] Some words to if/unless on targets git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@321171 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/using.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/manual/using.html b/docs/manual/using.html index 5b3e3800e..6384609c5 100644 --- a/docs/manual/using.html +++ b/docs/manual/using.html @@ -107,10 +107,26 @@ to the empty string is still an existing property. For example:

<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), the target will be run. In the second +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.

+

Only one propertyname can be specified in the if/unless clause. If you want to check +multiple conditions, you can use a dependend target for computing the result for the check:

+
+<target name="myTarget" depends="myTarget.check" if="myTarget.run">
+    <echo>Files foo.txt and bar.txt are present.</echo>
+</target>
+
+<target name="myTarget.check">
+    <condition property="myTarget.run">
+        <and>
+            <available file="foo.txt"/>
+            <available file="bar.txt"/>
+        </and>
+    </condition>
+</target>
+

If no if and no unless attribute is present, the target will always be executed.