Index: Exit.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exit.java,v
retrieving revision 1.1
diff -u -r1.1 Exit.java
--- Exit.java	2000/09/07 11:09:02	1.1
+++ Exit.java	2000/09/23 12:10:12
@@ -64,16 +64,48 @@
  */
 public class Exit extends Task { 
     private String message;
+    private String ifCondition = null;
+    private String unlessCondition = null;
     
     public void setMessage(String value) { 
         this.message = value;
     }
+
+    public void setIf(String condition) { 
+        ifCondition = condition;
+    }
+
+    public void setUnless(String condition) { 
+        unlessCondition = condition;
+    }
     
-    public void execute() throws BuildException {
-        if (message != null && message.length() > 0) { 
-            throw new BuildException(message);
-        } else {
-            throw new BuildException("No message");
+    public void execute() throws BuildException { 
+        if (testIfCondition() && testUnlessCondition()) { 
+            if (message != null && message.length() > 0) { 
+                throw new BuildException(message);
+            } else {
+                throw new BuildException("No message");
+            }
         }
+    }
+
+    /**
+     * Test whether the value specified as 'if' exists
+     * and has a value assigned (i.e. is not equal to '')
+     */
+    private boolean testIfCondition() { 
+        if (ifCondition == null) return true;
+        String value = project.getProperty(ifCondition);
+        return (value != null && !value.equals(""));
+    }
+
+    /**
+     * Test whether the value specified as 'unless' does not 
+     * exist or has no value assigned (i.e. is equal to '')
+     */
+    private boolean testUnlessCondition() {
+        if (unlessCondition == null) return true;
+        String value = project.getProperty(unlessCondition);
+        return (value == null || value.equals(""));
     }
 }
Index: index.html
===================================================================
RCS file: /home/cvspublic/jakarta-ant/docs/index.html,v
retrieving revision 1.112
diff -u -r1.112 index.html
--- index.html	2000/09/20 15:53:25	1.112
+++ index.html	2000/09/23 12:12:10
@@ -275,7 +275,7 @@
 <p>Each project defines one or more targets. A target is a set of tasks you want
 to be executed. When starting Ant, you can select which target you want to have
 executed. When no target is given, the project's default is used.</p>
-<h3>Targets</h3>
+<h3><a name="targets">Targets</a></h3>
 <p>A target can depend on other targets. You might have a target for compiling,
 for instance, and a target for creating a distributable. You can only build a
 distributable when you have compiled first, so the distribute target depends on
@@ -1712,6 +1712,18 @@
     <td valign="top">A message giving further information on why the build exited</td>
     <td align="center" valign="top">No</td>
   </tr>
+  <tr>
+    <td valign="top">if</td>
+    <td valign="top">Only fail if the specified property (without ${}) exists and the 
+	value of the property is not equal to &quot;&quot; (the empty String)</td>
+    <td align="center" valign="top">No</td>
+  </tr>
+  <tr>
+    <td valign="top">unless</td>
+    <td valign="top">Only fail if the specified property (without ${}) does not exist or the 
+	value of the property is equal to &quot;&quot; (the empty String)</td>
+    <td align="center" valign="top">No</td>
+  </tr>
 </table>
 <h3>Examples</h3>
 <pre>  &lt;fail/&gt;</pre>
@@ -1731,6 +1743,23 @@
 build.xml:4: Something wrong here.
 </pre>
 </p>
+
+<pre>
+  &lt;fail message=&quot;You must specify 'required.prop'.&quot;
+        unless=&quot;required.prop&quot;/&gt;</pre>
+<p>will exit the current build and print &quot;You must define 'required.prop'.&quot;
+to whereever your output goes:
+<pre>
+BUILD FAILED
+
+build.xml:10: You must define 'required.prop'.
+</pre>
+</p>
+<p><b>Note:</b> The behaviour of 'if' and 'unless' is slightly different compared 
+to the same attributes of <a href="#targets">&lt;target/&gt;</a> as it requires
+the property to contain something for if and allows the property to exist but 
+contain 'nothing' (an empty String) for unless.</p>
+
 <hr>
 <h2><a name="filter">Filter</a></h2>
 <h3>Description</h3>
