types package on the same instance, so I had to touch a lot of ather files as well. Reported by: Frederic Lavigne <fred@L2FProd.com> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267827 13f79535-47bb-0310-9956-ffa450edef68master
@@ -38,8 +38,8 @@ mkdir -p ${CLASSDIR} | |||||
echo ... Compiling Ant Classes | echo ... Compiling Ant Classes | ||||
javac -d ${CLASSDIR} ${TOOLS}/tar/*.java | javac -d ${CLASSDIR} ${TOOLS}/tar/*.java | ||||
javac -d ${CLASSDIR} ${TOOLS}/ant/*.java | |||||
javac -d ${CLASSDIR} ${TOOLS}/ant/types/*.java | javac -d ${CLASSDIR} ${TOOLS}/ant/types/*.java | ||||
javac -d ${CLASSDIR} ${TOOLS}/ant/*.java | |||||
javac -d ${CLASSDIR} ${TOOLS}/ant/taskdefs/*.java | javac -d ${CLASSDIR} ${TOOLS}/ant/taskdefs/*.java | ||||
echo ... Copying Required Files | echo ... Copying Required Files | ||||
@@ -69,7 +69,6 @@ | |||||
debug="on" | debug="on" | ||||
deprecation="off" | deprecation="off" | ||||
optimize="on" > | optimize="on" > | ||||
<exclude name="**/version.txt" /> | |||||
<exclude name="**/Script.java" unless="bsf.present" /> | <exclude name="**/Script.java" unless="bsf.present" /> | ||||
<exclude name="**/NetRexxC.java" unless="netrexx.present" /> | <exclude name="**/NetRexxC.java" unless="netrexx.present" /> | ||||
<exclude name="**/XslpLiaison.java" unless="xslp.present" /> | <exclude name="**/XslpLiaison.java" unless="xslp.present" /> | ||||
@@ -75,7 +75,7 @@ public class AntClassLoader extends ClassLoader { | |||||
/** | /** | ||||
* The classpath that is to be used when loading classes using this class loader. | * 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. | * The project to which this class loader belongs. | ||||
@@ -93,7 +93,8 @@ public class AntClassLoader extends ClassLoader { | |||||
* @param project the project to ehich this classloader is to belong. | * @param project the project to ehich this classloader is to belong. | ||||
* @param classpath the classpath to use to load the classes. | * @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.project = project; | ||||
this.classpath = classpath; | this.classpath = classpath; | ||||
} | } | ||||
@@ -54,6 +54,8 @@ | |||||
package org.apache.tools.ant; | package org.apache.tools.ant; | ||||
import org.apache.tools.ant.types.Path; | |||||
import java.lang.reflect.*; | import java.lang.reflect.*; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.*; | import java.util.*; | ||||
@@ -447,6 +449,16 @@ public class IntrospectionHelper { | |||||
}; | }; | ||||
// 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)}); | |||||
} | |||||
}; | |||||
// EnumeratedAttributes have their own helper class | // EnumeratedAttributes have their own helper class | ||||
} else if (org.apache.tools.ant.EnumeratedAttribute.class.isAssignableFrom(arg)) { | } else if (org.apache.tools.ant.EnumeratedAttribute.class.isAssignableFrom(arg)) { | ||||
return new AttributeSetter() { | return new AttributeSetter() { | ||||
@@ -54,176 +54,18 @@ | |||||
package org.apache.tools.ant; | 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); | |||||
} | } | ||||
} | } |
@@ -56,7 +56,7 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import org.apache.tools.ant.BuildException; | 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 org.apache.tools.ant.types.Commandline; | ||||
import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.InvocationTargetException; | ||||
@@ -54,7 +54,11 @@ | |||||
package org.apache.tools.ant.taskdefs; | 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.lang.reflect.*; | ||||
import java.util.*; | import java.util.*; | ||||
@@ -139,7 +143,7 @@ public class Java extends Exec { | |||||
*/ | */ | ||||
public Path createClasspath() { | public Path createClasspath() { | ||||
if (classpath == null) { | if (classpath == null) { | ||||
classpath = new Path(); | |||||
classpath = new Path(project); | |||||
} | } | ||||
return classpath; | return classpath; | ||||
} | } | ||||
@@ -54,7 +54,10 @@ | |||||
package org.apache.tools.ant.taskdefs; | 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.lang.reflect.Method; | ||||
import java.io.*; | import java.io.*; | ||||
@@ -115,7 +118,7 @@ public class Javac extends MatchingTask { | |||||
*/ | */ | ||||
public Path createSrc() { | public Path createSrc() { | ||||
if (src != null) { | if (src != null) { | ||||
src = new Path(); | |||||
src = new Path(project); | |||||
} | } | ||||
return src; | return src; | ||||
} | } | ||||
@@ -155,7 +158,7 @@ public class Javac extends MatchingTask { | |||||
*/ | */ | ||||
public Path createClasspath() { | public Path createClasspath() { | ||||
if (compileClasspath == null) { | if (compileClasspath == null) { | ||||
compileClasspath = new Path(); | |||||
compileClasspath = new Path(project); | |||||
} | } | ||||
return compileClasspath; | return compileClasspath; | ||||
} | } | ||||
@@ -177,7 +180,7 @@ public class Javac extends MatchingTask { | |||||
*/ | */ | ||||
public Path createBootclasspath() { | public Path createBootclasspath() { | ||||
if (bootclasspath == null) { | if (bootclasspath == null) { | ||||
bootclasspath = new Path(); | |||||
bootclasspath = new Path(project); | |||||
} | } | ||||
return bootclasspath; | return bootclasspath; | ||||
} | } | ||||
@@ -199,7 +202,7 @@ public class Javac extends MatchingTask { | |||||
*/ | */ | ||||
public Path createExtdirs() { | public Path createExtdirs() { | ||||
if (extdirs == null) { | if (extdirs == null) { | ||||
extdirs = new Path(); | |||||
extdirs = new Path(project); | |||||
} | } | ||||
return extdirs; | return extdirs; | ||||
} | } | ||||
@@ -349,7 +352,7 @@ public class Javac extends MatchingTask { | |||||
* <code>classes.zip</code> be added to the classpath. | * <code>classes.zip</code> be added to the classpath. | ||||
*/ | */ | ||||
private Path getCompileClasspath(boolean addRuntime) { | private Path getCompileClasspath(boolean addRuntime) { | ||||
Path classpath = new Path(); | |||||
Path classpath = new Path(project); | |||||
// add dest dir to classpath so that previously compiled and | // add dest dir to classpath so that previously compiled and | ||||
// untouched classes are on classpath | // untouched classes are on classpath | ||||
@@ -368,20 +371,23 @@ public class Javac extends MatchingTask { | |||||
if (addRuntime) { | if (addRuntime) { | ||||
if (Project.getJavaVersion() == Project.JAVA_1_1) { | if (Project.getJavaVersion() == Project.JAVA_1_1) { | ||||
addExistingToClasspath(classpath, | addExistingToClasspath(classpath, | ||||
new Path(System.getProperty("java.home") | |||||
new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | + File.separator + "lib" | ||||
+ File.separator | + File.separator | ||||
+ "classes.zip")); | + "classes.zip")); | ||||
} else { | } else { | ||||
// JDK > 1.1 seems to set java.home to the JRE directory. | // JDK > 1.1 seems to set java.home to the JRE directory. | ||||
addExistingToClasspath(classpath, | addExistingToClasspath(classpath, | ||||
new Path(System.getProperty("java.home") | |||||
new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | + File.separator + "lib" | ||||
+ File.separator + "rt.jar")); | + File.separator + "rt.jar")); | ||||
// Just keep the old version as well and let addExistingToPath | // Just keep the old version as well and let addExistingToPath | ||||
// sort it out. | // sort it out. | ||||
addExistingToClasspath(classpath, | addExistingToClasspath(classpath, | ||||
new Path(System.getProperty("java.home") | |||||
new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator +"jre" | + File.separator +"jre" | ||||
+ File.separator + "lib" | + File.separator + "lib" | ||||
+ File.separator + "rt.jar")); | + File.separator + "rt.jar")); | ||||
@@ -608,7 +614,7 @@ public class Javac extends MatchingTask { | |||||
private void doJikesCompile() throws BuildException { | private void doJikesCompile() throws BuildException { | ||||
log("Using jikes compiler", Project.MSG_VERBOSE); | log("Using jikes compiler", Project.MSG_VERBOSE); | ||||
Path classpath = new Path(); | |||||
Path classpath = new Path(project); | |||||
// Jikes doesn't support bootclasspath dir (-bootclasspath) | // Jikes doesn't support bootclasspath dir (-bootclasspath) | ||||
// so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
@@ -54,7 +54,10 @@ | |||||
package org.apache.tools.ant.taskdefs; | 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.io.*; | ||||
import java.util.*; | import java.util.*; | ||||
@@ -137,7 +140,7 @@ public class Javadoc extends Exec { | |||||
public Path createPath() { | public Path createPath() { | ||||
if (path == null) { | if (path == null) { | ||||
path = new Path(); | |||||
path = new Path(getProject()); | |||||
} | } | ||||
return path; | return path; | ||||
} | } | ||||
@@ -219,7 +222,7 @@ public class Javadoc extends Exec { | |||||
} | } | ||||
public Path createSourcepath() { | public Path createSourcepath() { | ||||
if (sourcePath == null) { | if (sourcePath == null) { | ||||
sourcePath = new Path(); | |||||
sourcePath = new Path(project); | |||||
} | } | ||||
return sourcePath; | return sourcePath; | ||||
} | } | ||||
@@ -278,7 +281,7 @@ public class Javadoc extends Exec { | |||||
} | } | ||||
public Path createClasspath() { | public Path createClasspath() { | ||||
if (classpath == null) { | if (classpath == null) { | ||||
classpath = new Path(); | |||||
classpath = new Path(project); | |||||
} | } | ||||
return classpath; | return classpath; | ||||
} | } | ||||
@@ -291,7 +294,7 @@ public class Javadoc extends Exec { | |||||
} | } | ||||
public Path createBootclasspath() { | public Path createBootclasspath() { | ||||
if (bootclasspath == null) { | if (bootclasspath == null) { | ||||
bootclasspath = new Path(); | |||||
bootclasspath = new Path(project); | |||||
} | } | ||||
return bootclasspath; | return bootclasspath; | ||||
} | } | ||||
@@ -448,6 +451,10 @@ public class Javadoc extends Exec { | |||||
} | } | ||||
public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
if ("javadoc2".equals(taskType)) { | |||||
log("!! javadoc2 is deprecated. Use javadoc instead. !!"); | |||||
} | |||||
if (sourcePath == null || destDir == null ) { | if (sourcePath == null || destDir == null ) { | ||||
String msg = "sourcePath and destDir attributes must be set!"; | String msg = "sourcePath and destDir attributes must be set!"; | ||||
throw new BuildException(msg); | throw new BuildException(msg); | ||||
@@ -54,7 +54,11 @@ | |||||
package org.apache.tools.ant.taskdefs; | 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.io.*; | ||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
@@ -136,7 +140,7 @@ public class Rmic extends MatchingTask { | |||||
*/ | */ | ||||
public Path createClasspath() { | public Path createClasspath() { | ||||
if (compileClasspath == null) { | if (compileClasspath == null) { | ||||
compileClasspath = new Path(); | |||||
compileClasspath = new Path(project); | |||||
} | } | ||||
return compileClasspath; | return compileClasspath; | ||||
} | } | ||||
@@ -368,7 +372,7 @@ public class Rmic extends MatchingTask { | |||||
private String getCompileClasspath(File baseFile) { | private String getCompileClasspath(File baseFile) { | ||||
// add dest dir to classpath so that previously compiled and | // add dest dir to classpath so that previously compiled and | ||||
// untouched classes are on classpath | // untouched classes are on classpath | ||||
Path classpath = new Path(baseFile.getAbsolutePath()); | |||||
Path classpath = new Path(project, baseFile.getAbsolutePath()); | |||||
// add our classpath to the mix | // add our classpath to the mix | ||||
@@ -383,7 +387,7 @@ public class Rmic extends MatchingTask { | |||||
if (Project.getJavaVersion().startsWith("1.2")) { | if (Project.getJavaVersion().startsWith("1.2")) { | ||||
String bootcp = System.getProperty("sun.boot.class.path"); | String bootcp = System.getProperty("sun.boot.class.path"); | ||||
if (bootcp != null) { | if (bootcp != null) { | ||||
addExistingToClasspath(classpath, new Path(bootcp)); | |||||
addExistingToClasspath(classpath, new Path(project, bootcp)); | |||||
} | } | ||||
} | } | ||||
return classpath.toString(); | return classpath.toString(); | ||||
@@ -53,8 +53,11 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.taskdefs.optional.ejb; | 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.taskdefs.*; | ||||
import org.apache.tools.ant.types.Path; | |||||
import java.io.File; | import java.io.File; | ||||
@@ -126,7 +129,7 @@ public class DDCreator extends MatchingTask { | |||||
ddCreatorTask.setFork("yes"); | ddCreatorTask.setFork("yes"); | ||||
ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper"); | ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper"); | ||||
ddCreatorTask.setArgs(args); | ddCreatorTask.setArgs(args); | ||||
ddCreatorTask.setClasspath(new Path(execClassPath)); | |||||
ddCreatorTask.setClasspath(new Path(project, execClassPath)); | |||||
if (ddCreatorTask.executeJava() != 0) { | if (ddCreatorTask.executeJava() != 0) { | ||||
throw new BuildException("Execution of ddcreator helper failed"); | throw new BuildException("Execution of ddcreator helper failed"); | ||||
} | } | ||||
@@ -54,8 +54,11 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.ejb; | 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.taskdefs.*; | ||||
import org.apache.tools.ant.types.Path; | |||||
import java.io.File; | import java.io.File; | ||||
@@ -146,7 +149,7 @@ public class Ejbc extends MatchingTask { | |||||
} | } | ||||
helperTask.setArgs(args); | helperTask.setArgs(args); | ||||
helperTask.setClasspath(new Path(execClassPath)); | |||||
helperTask.setClasspath(new Path(project, execClassPath)); | |||||
if (helperTask.executeJava() != 0) { | if (helperTask.executeJava() != 0) { | ||||
throw new BuildException("Execution of ejbc helper failed"); | throw new BuildException("Execution of ejbc helper failed"); | ||||
} | } | ||||
@@ -54,8 +54,11 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.ejb; | 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.taskdefs.*; | ||||
import org.apache.tools.ant.types.Path; | |||||
import java.io.File; | import java.io.File; | ||||
@@ -156,7 +159,7 @@ public class WLRun extends Task { | |||||
jvmArgs += " -Dweblogic.system.propertiesFile=" + weblogicPropertiesFile; | jvmArgs += " -Dweblogic.system.propertiesFile=" + weblogicPropertiesFile; | ||||
weblogicServer.setJvmargs(jvmArgs); | weblogicServer.setJvmargs(jvmArgs); | ||||
weblogicServer.setClasspath(new Path(execClassPath)); | |||||
weblogicServer.setClasspath(new Path(project, execClassPath)); | |||||
if (weblogicServer.executeJava() != 0) { | if (weblogicServer.executeJava() != 0) { | ||||
throw new BuildException("Execution of weblogic server failed"); | throw new BuildException("Execution of weblogic server failed"); | ||||
} | } | ||||
@@ -54,8 +54,11 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.ejb; | 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.taskdefs.*; | ||||
import org.apache.tools.ant.types.Path; | |||||
import java.io.File; | import java.io.File; | ||||
@@ -116,7 +119,7 @@ public class WLStop extends Task { | |||||
String args = serverURL + " SHUTDOWN " + username + " " + password + " " + delay; | String args = serverURL + " SHUTDOWN " + username + " " + password + " " + delay; | ||||
weblogicAdmin.setArgs(args); | weblogicAdmin.setArgs(args); | ||||
weblogicAdmin.setClasspath(new Path(execClassPath)); | |||||
weblogicAdmin.setClasspath(new Path(project, execClassPath)); | |||||
weblogicAdmin.execute(); | weblogicAdmin.execute(); | ||||
} | } | ||||
@@ -54,10 +54,13 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.javacc; | 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.taskdefs.*; | ||||
import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
import org.apache.tools.ant.types.Path; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
@@ -68,7 +71,7 @@ import java.io.IOException; | |||||
*/ | */ | ||||
public class JavaCC extends Task { | public class JavaCC extends Task { | ||||
private Path userclasspath = new Path(); | |||||
private Path userclasspath = null; | |||||
private File metahome = null; | private File metahome = null; | ||||
private File metaworkingdir = null; | private File metaworkingdir = null; | ||||
private File target = null; | private File target = null; | ||||
@@ -89,6 +92,10 @@ public class JavaCC extends Task { | |||||
} | } | ||||
public Path createUserclasspath() { | public Path createUserclasspath() { | ||||
if (userclasspath == null) { | |||||
userclasspath = new Path(project); | |||||
} | |||||
return userclasspath; | return userclasspath; | ||||
} | } | ||||
@@ -126,7 +133,7 @@ public class JavaCC extends Task { | |||||
throw new BuildException("Userclasspath not set."); | 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/metamatadebug.jar"); | ||||
classpath.createPathElement().setLocation(metahome.getAbsolutePath() + "/lib/metamata.jar"); | classpath.createPathElement().setLocation(metahome.getAbsolutePath() + "/lib/metamata.jar"); | ||||
classpath.createPathElement().setLocation(metahome.getAbsolutePath() + "/lib/JavaCC.zip"); | classpath.createPathElement().setLocation(metahome.getAbsolutePath() + "/lib/JavaCC.zip"); | ||||
@@ -55,12 +55,12 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.junit; | package org.apache.tools.ant.taskdefs.optional.junit; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Path; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.taskdefs.*; | import org.apache.tools.ant.taskdefs.*; | ||||
import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
import org.apache.tools.ant.types.Path; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
@@ -104,7 +104,7 @@ public class JUnitTask extends Task { | |||||
* @param junit path to junit classes. | * @param junit path to junit classes. | ||||
*/ | */ | ||||
public void setJunit(String junit) { | public void setJunit(String junit) { | ||||
commandline.createClasspath().createPathElement().setLocation(junit); | |||||
commandline.createClasspath(project).createPathElement().setLocation(junit); | |||||
} | } | ||||
public void setDefaulthaltonerror(boolean value) { | public void setDefaulthaltonerror(boolean value) { | ||||
@@ -155,7 +155,7 @@ public class JUnitTask extends Task { | |||||
public Path createClasspath() { | public Path createClasspath() { | ||||
return commandline.createClasspath(); | |||||
return commandline.createClasspath(project); | |||||
} | } | ||||
public JUnitTest createTest() { | public JUnitTest createTest() { | ||||
@@ -189,7 +189,7 @@ public class JUnitTask extends Task { | |||||
final String oldclasspath = System.getProperty("java.class.path"); | 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 | * This doesn't work on JDK 1.1, should use a Classloader of our own | ||||
* anyway --SB | * anyway --SB | ||||
@@ -54,7 +54,7 @@ | |||||
package org.apache.tools.ant.types; | package org.apache.tools.ant.types; | ||||
import org.apache.tools.ant.Path; | |||||
import org.apache.tools.ant.Project; | |||||
/* | /* | ||||
* | * | ||||
@@ -64,7 +64,7 @@ public class CommandlineJava { | |||||
private Commandline vmCommand = new Commandline(); | private Commandline vmCommand = new Commandline(); | ||||
private Commandline javaCommand = new Commandline(); | private Commandline javaCommand = new Commandline(); | ||||
private Path classpath = new Path(); | |||||
private Path classpath = null; | |||||
private String vmVersion; | private String vmVersion; | ||||
@@ -93,7 +93,10 @@ public class CommandlineJava { | |||||
javaCommand.setExecutable(classname); | javaCommand.setExecutable(classname); | ||||
} | } | ||||
public Path createClasspath() { | |||||
public Path createClasspath(Project p) { | |||||
if (classpath == null) { | |||||
classpath = new Path(p); | |||||
} | |||||
return classpath; | return classpath; | ||||
} | } | ||||
@@ -103,14 +106,14 @@ public class CommandlineJava { | |||||
public String[] getCommandline() { | public String[] getCommandline() { | ||||
int size = vmCommand.size() + javaCommand.size(); | int size = vmCommand.size() + javaCommand.size(); | ||||
if (classpath.size() > 0) { | |||||
if (classpath != null && classpath.size() > 0) { | |||||
size += 2; | size += 2; | ||||
} | } | ||||
String[] result = new String[size]; | String[] result = new String[size]; | ||||
System.arraycopy(vmCommand.getCommandline(), 0, | System.arraycopy(vmCommand.getCommandline(), 0, | ||||
result, 0, vmCommand.size()); | result, 0, vmCommand.size()); | ||||
if (classpath.size() > 0) { | |||||
if (classpath != null && classpath.size() > 0) { | |||||
result[vmCommand.size()] = "-classpath"; | result[vmCommand.size()] = "-classpath"; | ||||
result[vmCommand.size()+1] = classpath.toString(); | result[vmCommand.size()+1] = classpath.toString(); | ||||
} | } | ||||
@@ -127,7 +130,7 @@ public class CommandlineJava { | |||||
public int size() { | public int size() { | ||||
int size = vmCommand.size() + javaCommand.size(); | int size = vmCommand.size() + javaCommand.size(); | ||||
if (classpath.size() > 0) { | |||||
if (classpath != null && classpath.size() > 0) { | |||||
size += 2; | size += 2; | ||||
} | } | ||||
return size; | return size; | ||||