Index: src/main/org/apache/tools/ant/Task.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Task.java,v
retrieving revision 1.27.2.2
diff -u -r1.27.2.2 Task.java
--- src/main/org/apache/tools/ant/Task.java	12 Jun 2002 08:48:21 -0000	1.27.2.2
+++ src/main/org/apache/tools/ant/Task.java	21 Jul 2002 23:47:57 -0000
@@ -54,6 +54,8 @@
 
 package org.apache.tools.ant;
 
+import org.apache.tools.ant.types.ConditionType;
+
 /**
  * Base class for all tasks.
  *
@@ -69,6 +71,8 @@
     protected String description = null;
     /** Location within the build file of this task definition. */
     protected Location location = Location.UNKNOWN_LOCATION;
+    /** Optional condition controlling whether to execute the task. */
+    protected ConditionType condition = null;
     /** 
      * Name of this task to be used for logging purposes. 
      * This defaults to the same as the type, but may be
@@ -166,6 +170,19 @@
     }
 
     /**
+     * Adds an optional condition to each and every Ant task.
+     *
+     * @exception BuildException if more than one condition is used
+     */
+    public void addCondition(ConditionType condition) {
+        if (this.condition != null) {
+            throw new BuildException("You must not nest more than one " 
+                + "condition into a task");
+        }
+        this.condition = condition;
+    }
+
+    /**
      * Called by the project to let the task initialize properly.
      * The default implementation is a no-op.
      *
@@ -314,6 +331,11 @@
             try {
                 project.fireTaskStarted(this);
                 maybeConfigure();
+                if (condition != null && !condition.eval()) {
+                    log("Task not executed since condition is false",
+                        Project.MSG_DEBUG);
+                    return;
+                }
                 execute();
                 project.fireTaskFinished(this, null);
             } catch (RuntimeException exc) {
