DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41647>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41647

           Summary: ConditionBase and TaskContainer do not work together
                    since ant 1.6.0
           Product: Ant
           Version: 1.6.0
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]


A bug has been reported against ant-contrib's assert task. On
checking, it seems that since ant.1.6.0 ConditionBase and TaskContainer
to not work together.

The following works for ant1.5.4,ant1.6.0,2,5,ant1.7.0:

public class Adapt implements TaskContainer {
    private List<Task> tasks = new ArrayList<Task>();

    public void addTask(Task task) {
        tasks.add(task);
    }

    public void execute() {
        for (Task t: tasks) {
            t.perform();
        }
    }
}
    <taskdef name="ad" classpath="build"
             classname="Adapt"/>
    <ad>
      <echo>Hello</echo>
    </ad>


The following only works in ant 1.5.4:
public class ConditionRun extends ConditionBase implements TaskContainer {
    private List<Task> tasks = new ArrayList<Task>();

    public void addTask(Task task) {
        tasks.add(task);
    }

    public void execute() {
        for (Task t: tasks) {
            t.perform();
        }
    }
}
    <taskdef name="conditionrun" classpath="build"
             classname="ConditionRun"/>
    <conditionrun>
      <echo>Hello</echo>
    </conditionrun>

For ant1.6.0 and above one gets the message:
Class ConditionRun doesn't support the nested "echo" element.

The build.xml showing the problem is:
<project name="adapt" default="run">
  <target name="bootstrap">
    <mkdir dir="src"/>
    <echo file="src/Adapt.java">
import org.apache.tools.ant.*;
import java.util.*;

public class Adapt implements TaskContainer {
    private List&lt;Task> tasks = new ArrayList&lt;Task>();

    public void addTask(Task task) {
        tasks.add(task);
    }

    public void execute() {
        for (Task t: tasks) {
            t.perform();
        }
    }
}
    </echo>
    <echo file="src/ConditionRun.java">
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.condition.*;
import java.util.*;

public class ConditionRun extends ConditionBase implements TaskContainer {
    private List&lt;Task> tasks = new ArrayList&lt;Task>();

    public void addTask(Task task) {
        tasks.add(task);
    }

    public void execute() {
        for (Task t: tasks) {
            t.perform();
        }
    }
}
    </echo>
  </target>
  <target name="build">
    <mkdir dir="build"/>
    <javac debug="yes"
           target="1.5"
           source="1.5"
           destdir="build"
           srcdir="src"/>
  </target>

  <target name="clean">
    <delete dir="build"/>
  </target>

  <target name="run" depends="build">
    <taskdef name="ad" classpath="build"
             classname="Adapt"/>
    <ad>
      <echo>Hello</echo>
    </ad>
    <taskdef name="conditionrun" classpath="build"
             classname="ConditionRun"/>
    <conditionrun>
      <echo>Hello</echo>
    </conditionrun>
  </target>

  <target name="wipe" depends="clean">
    <delete dir="src"/>
  </target>


</project>

use: ant bootstrap to create the source files
     ant  to show the problem

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to