You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@locus.apache.org on 2000/07/24 17:53:08 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types CommandlineJava.java
bodewig 00/07/24 08:53:07
Modified: . bootstrap.sh build.xml
src/main/org/apache/tools/ant AntClassLoader.java
IntrospectionHelper.java Path.java
src/main/org/apache/tools/ant/taskdefs ExecuteJava.java
Java.java Javac.java Javadoc.java Rmic.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb
DDCreator.java Ejbc.java WLRun.java WLStop.java
src/main/org/apache/tools/ant/taskdefs/optional/javacc
JavaCC.java
src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
src/main/org/apache/tools/ant/types CommandlineJava.java
Log:
Made Path resolve relative paths through Project. Moved it to the
types package on the same instance, so I had to touch a lot of ather
files as well.
Reported by: Frederic Lavigne <fr...@L2FProd.com>
Revision Changes Path
1.20 +1 -1 jakarta-ant/bootstrap.sh
Index: bootstrap.sh
===================================================================
RCS file: /home/cvs/jakarta-ant/bootstrap.sh,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- bootstrap.sh 2000/07/19 13:00:25 1.19
+++ bootstrap.sh 2000/07/24 15:52:50 1.20
@@ -38,8 +38,8 @@
echo ... Compiling Ant Classes
javac -d ${CLASSDIR} ${TOOLS}/tar/*.java
-javac -d ${CLASSDIR} ${TOOLS}/ant/*.java
javac -d ${CLASSDIR} ${TOOLS}/ant/types/*.java
+javac -d ${CLASSDIR} ${TOOLS}/ant/*.java
javac -d ${CLASSDIR} ${TOOLS}/ant/taskdefs/*.java
echo ... Copying Required Files
1.45 +0 -1 jakarta-ant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/build.xml,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- build.xml 2000/07/24 12:40:54 1.44
+++ build.xml 2000/07/24 15:52:51 1.45
@@ -69,7 +69,6 @@
debug="on"
deprecation="off"
optimize="on" >
- <exclude name="**/version.txt" />
<exclude name="**/Script.java" unless="bsf.present" />
<exclude name="**/NetRexxC.java" unless="netrexx.present" />
<exclude name="**/XslpLiaison.java" unless="xslp.present" />
1.3 +3 -2 jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java
Index: AntClassLoader.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AntClassLoader.java 2000/07/23 14:20:25 1.2
+++ AntClassLoader.java 2000/07/24 15:52:53 1.3
@@ -75,7 +75,7 @@
/**
* The classpath that is to be used when loading classes using this class loader.
*/
- private Path classpath;
+ private org.apache.tools.ant.types.Path classpath;
/**
* The project to which this class loader belongs.
@@ -93,7 +93,8 @@
* @param project the project to ehich this classloader is to belong.
* @param classpath the classpath to use to load the classes.
*/
- public AntClassLoader(Project project, Path classpath) {
+ public AntClassLoader(Project project,
+ org.apache.tools.ant.types.Path classpath) {
this.project = project;
this.classpath = classpath;
}
1.7 +12 -0 jakarta-ant/src/main/org/apache/tools/ant/IntrospectionHelper.java
Index: IntrospectionHelper.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- IntrospectionHelper.java 2000/07/19 13:00:29 1.6
+++ IntrospectionHelper.java 2000/07/24 15:52:53 1.7
@@ -54,6 +54,8 @@
package org.apache.tools.ant;
+import org.apache.tools.ant.types.Path;
+
import java.lang.reflect.*;
import java.io.File;
import java.util.*;
@@ -443,6 +445,16 @@
public void set(Project p, Object parent, String value)
throws InvocationTargetException, IllegalAccessException {
m.invoke(parent, new File[] {p.resolveFile(value)});
+ }
+
+ };
+
+ // resolve relative paths through Project
+ } else if (org.apache.tools.ant.types.Path.class.equals(arg)) {
+ return new AttributeSetter() {
+ public void set(Project p, Object parent, String value)
+ throws InvocationTargetException, IllegalAccessException {
+ m.invoke(parent, new Path[] {new Path(p, value)});
}
};
1.5 +7 -165 jakarta-ant/src/main/org/apache/tools/ant/Path.java
Index: Path.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Path.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Path.java 2000/07/19 13:00:30 1.4
+++ Path.java 2000/07/24 15:52:53 1.5
@@ -54,176 +54,18 @@
package org.apache.tools.ant;
-import java.io.File;
-import java.util.Vector;
-import java.util.StringTokenizer;
-import java.text.CharacterIterator;
-import java.text.StringCharacterIterator;
-
/**
- * This object represents a path as used by CLASSPATH or PATH
- * environment variable.
- *
- * <code>
- * <sometask><br>
- * <somepath>
- * <pathelement location="/path/to/file.jar" />
- * <pathelement path="/path/to/file2.jar:/path/to/class2;/path/to/class3" />
- * <pathelement location="/path/to/file3.jar" />
- * <pathelement location="/path/to/file4.jar" />
- * </somepath>
- * </sometask><br>
- * </code>
- *
- * The object implemention <code>sometask</code> must provide a method called
- * <code>createSomepath</code> which returns an instance of <code>Path</code>.
- * Nested path definitions are handled by the Path object and must be labeled
- * <code>pathelement</code>.<p>
+ * This class has been moved to org.apache.tools.ant.types.
*
- * The path element takes a parameter <code>path</code> which will be parsed
- * and split into single elements. It will usually be used
- * to define a path from an environment variable.
- *
- * @author Thomas.Haas@softwired-inc.com
- * @author <a href="mailto:stefan.bodewig@megabit.net">Stefan Bodewig</a>
+ * @deprecated This class has been moved to org.apache.tools.ant.types.
*/
-
-public class Path {
-
- private Vector definition;
-
- public static Path systemClasspath =
- new Path(System.getProperty("java.class.path"));
-
- public Path(String path) {
- this();
- setPath(path);
- }
-
- public Path() {
- definition = new Vector();
- }
-
- /**
- * Adds a element definition to the path.
- * @param location the location of the element to add (must not be
- * <code>null</code> nor empty.
- */
- public void setLocation(String location) {
- if (location != null && location.length() > 0) {
- String element = translateFile(location);
- if (definition.indexOf(element) == -1) {
- definition.addElement(element);
- }
- }
- }
-
-
- /**
- * Append the contents of the other Path instance to this.
- */
- public void append(Path other) {
- String[] l = other.list();
- for (int i=0; i<l.length; i++) {
- if (definition.indexOf(l[i]) == -1) {
- definition.addElement(l[i]);
- }
- }
- }
-
- /**
- * Parses a path definition and creates single PathElements.
- * @param path the path definition.
- */
- public void setPath(String path) {
- final Vector elements = translatePath(path);
- for (int i=0; i < elements.size(); i++) {
- String element = (String) elements.elementAt(i);
- if (definition.indexOf(element) == -1) {
- definition.addElement(element);
- }
- }
- }
-
-
- public Path createPathElement() {
- return this;
- }
-
-
- /**
- * Returns all path elements defined by this and netsed path objects.
- * @return list of path elements.
- */
- public String[] list() {
- final String[] result = new String[definition.size()];
- definition.copyInto(result);
- return result;
- }
-
-
- /**
- * Returns a textual representation of the path, which can be used as
- * CLASSPATH or PATH environment variable definition.
- * @return a textual representation of the path.
- */
- public String toString() {
- final String[] list = list();
-
- // empty path return empty string
- if (list.length == 0) return "";
-
- // path containing one or more elements
- final StringBuffer result = new StringBuffer(list[0].toString());
- for (int i=1; i < list.length; i++) {
- result.append(File.pathSeparatorChar);
- result.append(list[i]);
- }
-
- return result.toString();
- }
-
-
-
- public static Vector translatePath(String source) {
- final Vector result = new Vector();
- if (source == null) return result;
-
- PathTokenizer tok = new PathTokenizer(source);
- StringBuffer element = new StringBuffer();
- while (tok.hasMoreTokens()) {
- element.setLength(0);
- element.append(tok.nextToken());
- for (int i=0; i<element.length(); i++) {
- translateFileSep(element, i);
- }
- result.addElement(element.toString());
- }
- return result;
- }
-
-
- public static String translateFile(String source) {
- if (source == null) return "";
-
- final StringBuffer result = new StringBuffer(source);
- for (int i=0; i < result.length(); i++) {
- translateFileSep(result, i);
- }
-
- return result.toString();
- }
-
- protected static boolean translateFileSep(StringBuffer buffer, int pos) {
- if (buffer.charAt(pos) == '/' || buffer.charAt(pos) == '\\') {
- buffer.setCharAt(pos, File.separatorChar);
- return true;
- }
- return false;
+public class Path extends org.apache.tools.ant.types.Path {
+ public Path(Project p, String path) {
+ super(p, path);
}
- public int size() {
- return definition.size();
+ public Path(Project p) {
+ super(p);
}
}
1.2 +1 -1 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
Index: ExecuteJava.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExecuteJava.java 2000/07/19 13:00:31 1.1
+++ ExecuteJava.java 2000/07/24 15:52:57 1.2
@@ -56,7 +56,7 @@
package org.apache.tools.ant.taskdefs;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Path;
+import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Commandline;
import java.lang.reflect.InvocationTargetException;
1.12 +6 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java
Index: Java.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Java.java 2000/07/19 12:35:12 1.11
+++ Java.java 2000/07/24 15:52:57 1.12
@@ -54,7 +54,11 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+
import java.lang.reflect.*;
import java.util.*;
@@ -139,7 +143,7 @@
*/
public Path createClasspath() {
if (classpath == null) {
- classpath = new Path();
+ classpath = new Path(project);
}
return classpath;
}
1.26 +16 -10 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
Index: Javac.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Javac.java 2000/07/23 15:48:20 1.25
+++ Javac.java 2000/07/24 15:52:57 1.26
@@ -54,7 +54,10 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
import java.lang.reflect.Method;
import java.io.*;
@@ -115,7 +118,7 @@
*/
public Path createSrc() {
if (src != null) {
- src = new Path();
+ src = new Path(project);
}
return src;
}
@@ -155,7 +158,7 @@
*/
public Path createClasspath() {
if (compileClasspath == null) {
- compileClasspath = new Path();
+ compileClasspath = new Path(project);
}
return compileClasspath;
}
@@ -177,7 +180,7 @@
*/
public Path createBootclasspath() {
if (bootclasspath == null) {
- bootclasspath = new Path();
+ bootclasspath = new Path(project);
}
return bootclasspath;
}
@@ -199,7 +202,7 @@
*/
public Path createExtdirs() {
if (extdirs == null) {
- extdirs = new Path();
+ extdirs = new Path(project);
}
return extdirs;
}
@@ -349,7 +352,7 @@
* <code>classes.zip</code> be added to the classpath.
*/
private Path getCompileClasspath(boolean addRuntime) {
- Path classpath = new Path();
+ Path classpath = new Path(project);
// add dest dir to classpath so that previously compiled and
// untouched classes are on classpath
@@ -368,20 +371,23 @@
if (addRuntime) {
if (Project.getJavaVersion() == Project.JAVA_1_1) {
addExistingToClasspath(classpath,
- new Path(System.getProperty("java.home")
+ new Path(null,
+ System.getProperty("java.home")
+ File.separator + "lib"
+ File.separator
+ "classes.zip"));
} else {
// JDK > 1.1 seems to set java.home to the JRE directory.
addExistingToClasspath(classpath,
- new Path(System.getProperty("java.home")
+ new Path(null,
+ System.getProperty("java.home")
+ File.separator + "lib"
+ File.separator + "rt.jar"));
// Just keep the old version as well and let addExistingToPath
// sort it out.
addExistingToClasspath(classpath,
- new Path(System.getProperty("java.home")
+ new Path(null,
+ System.getProperty("java.home")
+ File.separator +"jre"
+ File.separator + "lib"
+ File.separator + "rt.jar"));
@@ -608,7 +614,7 @@
private void doJikesCompile() throws BuildException {
log("Using jikes compiler", Project.MSG_VERBOSE);
- Path classpath = new Path();
+ Path classpath = new Path(project);
// Jikes doesn't support bootclasspath dir (-bootclasspath)
// so we'll emulate it for compatibility and convenience.
1.19 +12 -5 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
Index: Javadoc.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Javadoc.java 2000/07/17 07:11:42 1.18
+++ Javadoc.java 2000/07/24 15:52:57 1.19
@@ -54,7 +54,10 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
import java.io.*;
import java.util.*;
@@ -137,7 +140,7 @@
public Path createPath() {
if (path == null) {
- path = new Path();
+ path = new Path(getProject());
}
return path;
}
@@ -219,7 +222,7 @@
}
public Path createSourcepath() {
if (sourcePath == null) {
- sourcePath = new Path();
+ sourcePath = new Path(project);
}
return sourcePath;
}
@@ -278,7 +281,7 @@
}
public Path createClasspath() {
if (classpath == null) {
- classpath = new Path();
+ classpath = new Path(project);
}
return classpath;
}
@@ -291,7 +294,7 @@
}
public Path createBootclasspath() {
if (bootclasspath == null) {
- bootclasspath = new Path();
+ bootclasspath = new Path(project);
}
return bootclasspath;
}
@@ -448,6 +451,10 @@
}
public void execute() throws BuildException {
+ if ("javadoc2".equals(taskType)) {
+ log("!! javadoc2 is deprecated. Use javadoc instead. !!");
+ }
+
if (sourcePath == null || destDir == null ) {
String msg = "sourcePath and destDir attributes must be set!";
throw new BuildException(msg);
1.10 +8 -4 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Rmic.java
Index: Rmic.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Rmic.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Rmic.java 2000/07/14 08:25:52 1.9
+++ Rmic.java 2000/07/24 15:52:58 1.10
@@ -54,7 +54,11 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+
import java.io.*;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -136,7 +140,7 @@
*/
public Path createClasspath() {
if (compileClasspath == null) {
- compileClasspath = new Path();
+ compileClasspath = new Path(project);
}
return compileClasspath;
}
@@ -368,7 +372,7 @@
private String getCompileClasspath(File baseFile) {
// add dest dir to classpath so that previously compiled and
// untouched classes are on classpath
- Path classpath = new Path(baseFile.getAbsolutePath());
+ Path classpath = new Path(project, baseFile.getAbsolutePath());
// add our classpath to the mix
@@ -383,7 +387,7 @@
if (Project.getJavaVersion().startsWith("1.2")) {
String bootcp = System.getProperty("sun.boot.class.path");
if (bootcp != null) {
- addExistingToClasspath(classpath, new Path(bootcp));
+ addExistingToClasspath(classpath, new Path(project, bootcp));
}
}
return classpath.toString();
1.4 +5 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
Index: DDCreator.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DDCreator.java 2000/07/20 13:25:50 1.3
+++ DDCreator.java 2000/07/24 15:53:00 1.4
@@ -53,8 +53,11 @@
*/
package org.apache.tools.ant.taskdefs.optional.ejb;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.types.Path;
import java.io.File;
@@ -126,7 +129,7 @@
ddCreatorTask.setFork("yes");
ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper");
ddCreatorTask.setArgs(args);
- ddCreatorTask.setClasspath(new Path(execClassPath));
+ ddCreatorTask.setClasspath(new Path(project, execClassPath));
if (ddCreatorTask.executeJava() != 0) {
throw new BuildException("Execution of ddcreator helper failed");
}
1.4 +5 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
Index: Ejbc.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Ejbc.java 2000/07/20 13:25:50 1.3
+++ Ejbc.java 2000/07/24 15:53:01 1.4
@@ -54,8 +54,11 @@
package org.apache.tools.ant.taskdefs.optional.ejb;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.types.Path;
import java.io.File;
@@ -146,7 +149,7 @@
}
helperTask.setArgs(args);
- helperTask.setClasspath(new Path(execClassPath));
+ helperTask.setClasspath(new Path(project, execClassPath));
if (helperTask.executeJava() != 0) {
throw new BuildException("Execution of ejbc helper failed");
}
1.3 +5 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java
Index: WLRun.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WLRun.java 2000/07/18 07:17:24 1.2
+++ WLRun.java 2000/07/24 15:53:01 1.3
@@ -54,8 +54,11 @@
package org.apache.tools.ant.taskdefs.optional.ejb;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.types.Path;
import java.io.File;
@@ -156,7 +159,7 @@
jvmArgs += " -Dweblogic.system.propertiesFile=" + weblogicPropertiesFile;
weblogicServer.setJvmargs(jvmArgs);
- weblogicServer.setClasspath(new Path(execClassPath));
+ weblogicServer.setClasspath(new Path(project, execClassPath));
if (weblogicServer.executeJava() != 0) {
throw new BuildException("Execution of weblogic server failed");
}
1.3 +5 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java
Index: WLStop.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WLStop.java 2000/07/18 07:17:24 1.2
+++ WLStop.java 2000/07/24 15:53:01 1.3
@@ -54,8 +54,11 @@
package org.apache.tools.ant.taskdefs.optional.ejb;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.types.Path;
import java.io.File;
@@ -116,7 +119,7 @@
String args = serverURL + " SHUTDOWN " + username + " " + password + " " + delay;
weblogicAdmin.setArgs(args);
- weblogicAdmin.setClasspath(new Path(execClassPath));
+ weblogicAdmin.setClasspath(new Path(project, execClassPath));
weblogicAdmin.execute();
}
1.3 +10 -3 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
Index: JavaCC.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JavaCC.java 2000/07/19 13:29:59 1.2
+++ JavaCC.java 2000/07/24 15:53:03 1.3
@@ -54,10 +54,13 @@
package org.apache.tools.ant.taskdefs.optional.javacc;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
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 java.io.File;
import java.io.IOException;
@@ -68,7 +71,7 @@
*/
public class JavaCC extends Task {
- private Path userclasspath = new Path();
+ private Path userclasspath = null;
private File metahome = null;
private File metaworkingdir = null;
private File target = null;
@@ -89,6 +92,10 @@
}
public Path createUserclasspath() {
+ if (userclasspath == null) {
+ userclasspath = new Path(project);
+ }
+
return userclasspath;
}
@@ -126,7 +133,7 @@
throw new BuildException("Userclasspath not set.");
}
- final Path classpath = cmdl.createClasspath();
+ final Path classpath = cmdl.createClasspath(project);
classpath.createPathElement().setLocation(metahome.getAbsolutePath() + "/lib/metamatadebug.jar");
classpath.createPathElement().setLocation(metahome.getAbsolutePath() + "/lib/metamata.jar");
classpath.createPathElement().setLocation(metahome.getAbsolutePath() + "/lib/JavaCC.zip");
1.2 +4 -4 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
Index: JUnitTask.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JUnitTask.java 2000/07/20 10:02:04 1.1
+++ JUnitTask.java 2000/07/24 15:53:04 1.2
@@ -55,12 +55,12 @@
package org.apache.tools.ant.taskdefs.optional.junit;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Path;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
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 java.io.File;
import java.io.IOException;
@@ -104,7 +104,7 @@
* @param junit path to junit classes.
*/
public void setJunit(String junit) {
- commandline.createClasspath().createPathElement().setLocation(junit);
+ commandline.createClasspath(project).createPathElement().setLocation(junit);
}
public void setDefaulthaltonerror(boolean value) {
@@ -155,7 +155,7 @@
public Path createClasspath() {
- return commandline.createClasspath();
+ return commandline.createClasspath(project);
}
public JUnitTest createTest() {
@@ -189,7 +189,7 @@
final String oldclasspath = System.getProperty("java.class.path");
- commandline.createClasspath().createPathElement().setPath(oldclasspath);
+ commandline.createClasspath(project).createPathElement().setPath(oldclasspath);
/*
* This doesn't work on JDK 1.1, should use a Classloader of our own
* anyway --SB
1.2 +9 -6 jakarta-ant/src/main/org/apache/tools/ant/types/CommandlineJava.java
Index: CommandlineJava.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/CommandlineJava.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CommandlineJava.java 2000/07/19 13:00:41 1.1
+++ CommandlineJava.java 2000/07/24 15:53:06 1.2
@@ -54,7 +54,7 @@
package org.apache.tools.ant.types;
-import org.apache.tools.ant.Path;
+import org.apache.tools.ant.Project;
/*
*
@@ -64,7 +64,7 @@
private Commandline vmCommand = new Commandline();
private Commandline javaCommand = new Commandline();
- private Path classpath = new Path();
+ private Path classpath = null;
private String vmVersion;
@@ -93,7 +93,10 @@
javaCommand.setExecutable(classname);
}
- public Path createClasspath() {
+ public Path createClasspath(Project p) {
+ if (classpath == null) {
+ classpath = new Path(p);
+ }
return classpath;
}
@@ -103,14 +106,14 @@
public String[] getCommandline() {
int size = vmCommand.size() + javaCommand.size();
- if (classpath.size() > 0) {
+ if (classpath != null && classpath.size() > 0) {
size += 2;
}
String[] result = new String[size];
System.arraycopy(vmCommand.getCommandline(), 0,
result, 0, vmCommand.size());
- if (classpath.size() > 0) {
+ if (classpath != null && classpath.size() > 0) {
result[vmCommand.size()] = "-classpath";
result[vmCommand.size()+1] = classpath.toString();
}
@@ -127,7 +130,7 @@
public int size() {
int size = vmCommand.size() + javaCommand.size();
- if (classpath.size() > 0) {
+ if (classpath != null && classpath.size() > 0) {
size += 2;
}
return size;