|
|
@@ -61,6 +61,7 @@ import org.apache.tools.ant.taskdefs.*; |
|
|
|
import org.apache.tools.ant.types.Commandline; |
|
|
|
import org.apache.tools.ant.types.CommandlineJava; |
|
|
|
import org.apache.tools.ant.types.Path; |
|
|
|
import org.apache.tools.ant.types.Reference; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
@@ -87,6 +88,7 @@ import java.util.Vector; |
|
|
|
public class JUnitTask extends Task { |
|
|
|
|
|
|
|
private CommandlineJava commandline = new CommandlineJava(); |
|
|
|
private Vector classpathReferences = new Vector(); |
|
|
|
private Vector tests = new Vector(); |
|
|
|
private Vector batchTests = new Vector(); |
|
|
|
private Vector formatters = new Vector(); |
|
|
@@ -132,6 +134,14 @@ public class JUnitTask extends Task { |
|
|
|
return commandline.createVmArgument(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Adds a reference to a CLASSPATH defined elsewhere - nested |
|
|
|
* <classpathref> element. |
|
|
|
*/ |
|
|
|
public void addClasspathRef(Reference r) { |
|
|
|
classpathReferences.addElement(r); |
|
|
|
} |
|
|
|
|
|
|
|
public Path createClasspath() { |
|
|
|
return commandline.createClasspath(project); |
|
|
|
} |
|
|
@@ -170,6 +180,19 @@ public class JUnitTask extends Task { |
|
|
|
boolean errorOccurred = false; |
|
|
|
boolean failureOccurred = false; |
|
|
|
|
|
|
|
Path classpath = commandline.createClasspath(project); |
|
|
|
for (int i=0; i<classpathReferences.size(); i++) { |
|
|
|
Reference r = (Reference) classpathReferences.elementAt(i); |
|
|
|
Object o = r.getReferencedObject(project); |
|
|
|
if (o instanceof Path) { |
|
|
|
classpath.append((Path) o); |
|
|
|
} else { |
|
|
|
String msg = r.getRefId()+" doesn\'t denote a classpath"; |
|
|
|
throw new BuildException(msg, location); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Enumeration list = batchTests.elements(); |
|
|
|
while (list.hasMoreElements()) { |
|
|
|
BatchTest test = (BatchTest)list.nextElement(); |
|
|
|