refid="...">. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267970 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -27,7 +27,8 @@ | |||
| <property name="build.tests" value="${build.dir}/testcases"/> | |||
| <property name="ant.dist.dir" value="../dist/ant"/> | |||
| <property name="classpath" value=""/> | |||
| <path id="classpath"> | |||
| </path> | |||
| <property name="packages" value="org.apache.tools.*"/> | |||
| <property name="manifest" value="src/etc/manifest"/> | |||
| @@ -79,10 +80,11 @@ | |||
| <javac srcdir="${src.dir}" | |||
| destdir="${build.classes}" | |||
| classpath="${classpath}" | |||
| debug="on" | |||
| deprecation="off" | |||
| optimize="on" > | |||
| <classpath refid="classpath" /> | |||
| <exclude name="**/Script.java" unless="bsf.present" /> | |||
| <exclude name="**/NetRexxC.java" unless="netrexx.present" /> | |||
| <exclude name="**/XslpLiaison.java" unless="xslp.present" /> | |||
| @@ -282,7 +284,7 @@ | |||
| optimize="on" > | |||
| <classpath> | |||
| <pathelement location="${lib.dir}/${name}.jar" /> | |||
| <pathelement path="${classpath}" /> | |||
| <path refid="classpath" /> | |||
| </classpath> | |||
| <include name="**/*.java"/> | |||
| <exclude name="**/AllJUnitTests.java" unless="junit.present" /> | |||
| @@ -308,7 +310,7 @@ | |||
| <classpath> | |||
| <pathelement location="${lib.dir}/${name}.jar" /> | |||
| <pathelement location="${build.tests}" /> | |||
| <pathelement path="${classpath}" /> | |||
| <path refid="classpath" /> | |||
| <pathelement path="${java.class.path}" /> | |||
| </classpath> | |||
| @@ -328,7 +330,7 @@ | |||
| <classpath> | |||
| <pathelement location="${lib.dir}/${name}.jar" /> | |||
| <pathelement location="${build.tests}" /> | |||
| <pathelement path="${classpath}" /> | |||
| <path refid="classpath" /> | |||
| <pathelement path="${java.class.path}" /> | |||
| </classpath> | |||
| </java> | |||
| @@ -573,13 +573,13 @@ example.</p> | |||
| <target ... > | |||
| <rmic ...> | |||
| <classpathref refid="project.class.path" /> | |||
| <classpath refid="project.class.path" /> | |||
| </rmic> | |||
| </target> | |||
| <target ... > | |||
| <javac ...> | |||
| <classpathref refid="project.class.path" /> | |||
| <classpath refid="project.class.path" /> | |||
| </javac> | |||
| </target> | |||
| </project> | |||
| @@ -2263,12 +2263,10 @@ the one that is currently running Ant.</p> | |||
| <p>Use nested <code><arg></code> and <code><jvmarg></code> | |||
| elements to specify arguments for the or the forked VM. See <a | |||
| href="index.html#arg">Command line arguments</a>.</p> | |||
| <h4>classpath and classpathref</h4> | |||
| <h4>classpath</h4> | |||
| <p><code>Java</code>'s <em>classpath</em> attribute is a <a | |||
| href="#path">PATH like structure</a> and can also be set via a nested | |||
| <em>classpath</em> element. PATHs defined elsewhere can be | |||
| <a href="#references">referred</a> to via nested <em>classpathref</em> | |||
| elements.</p> | |||
| <em>classpath</em> element.</p> | |||
| <h5>Example</h5> | |||
| <pre> | |||
| <java classname="test.Main" > | |||
| @@ -2429,14 +2427,12 @@ supports all attributes of <code><fileset></code> | |||
| <code><include></code>, <code><exclude></code>, | |||
| <code><patternset></code> and <code><patternsetref></code> | |||
| elements.</p> | |||
| <h4>src, classpath, classpathref, bootclasspath, bootclasspathref and extdirs</h4> | |||
| <h4>src, classpath, bootclasspath and extdirs</h4> | |||
| <p><code>Javac</code>'s <em>srcdir</em>, <em>classpath</em>, | |||
| <em>bootclasspath</em> and <em>extdirs</em> attributes are <a | |||
| href="#path">PATH like structure</a> and can also be set via nested | |||
| <em>src</em>, <em>classpath</em>, <em>bootclasspath</em> and | |||
| <em>extdirs</em> elements respectively. PATHs defined elsewhere can be | |||
| <a href="#references">referred</a> to via nested <em>classpathref</em> | |||
| and <em>bootclasspathref</em> elements.</p> | |||
| <em>extdirs</em> elements respectively.</p> | |||
| <h3>Examples</h3> | |||
| <pre> <javac srcdir="${src}" | |||
| @@ -2525,8 +2521,7 @@ instead.</p> | |||
| <td valign="top">Specify where to find source files</td> | |||
| <td align="center" valign="top">all</td> | |||
| <td align="center" rowspan="2">At least one of the two or nested | |||
| <code><sourcepath></code> or | |||
| <code><sourcepathref></code></td> | |||
| <code><sourcepath></code></td> | |||
| </tr> | |||
| <tr> | |||
| <td valign="top">sourcepathref</td> | |||
| @@ -2885,15 +2880,12 @@ arguments.</p> | |||
| </tr> | |||
| </table> | |||
| <h4>sourcepath, classpath, bootclasspath, sourcepathref, classpathref | |||
| and bootclasspathref</h4> | |||
| <h4>sourcepath, classpath and bootclasspath</h4> | |||
| <p><code>Javadoc</code>'s <em>sourcepath</em>, <em>classpath</em> and | |||
| <em>bootclasspath</em> attributes are <a href="#path">PATH like | |||
| structure</a> and can also be set via nested <em>sourcepath</em>, | |||
| <em>classpath</em> and <em>bootclasspath</em> elements | |||
| respectively. PATHs defined elsewhere can be <a | |||
| href="#references">referred</a> to via nested <em>sourcepathref</em>, | |||
| <em>classpathref</em> and <em>bootclasspathref</em> elements.</p> | |||
| respectively.</p> | |||
| <h3>Example</h3> | |||
| <pre> <javadoc packagenames="com.dummy.test.*" | |||
| @@ -3300,12 +3292,10 @@ elements.</p> | |||
| </tr> | |||
| </table> | |||
| <h3>Parameters specified as nested elements</h3> | |||
| <h4>classpath and classpathref</h4> | |||
| <h4>classpath</h4> | |||
| <p><code>Rmic</code>'s <em>classpath</em> attribute is a <a | |||
| href="#path">PATH like structure</a> and can also be set via a nested | |||
| <em>classpath</em> elements. PATHs defined elsewhere can be | |||
| <a href="#references">referred</a> to via nested <em>classpathref</em> | |||
| elements.</p> | |||
| <em>classpath</em> elements.</p> | |||
| <h3>Examples</h3> | |||
| <pre> <rmic classname="com.xyz.FooBar" base="${build}/classes" /></pre> | |||
| <p>runs the rmic compiler for the class <code>com.xyz.FooBar</code>. The | |||
| @@ -70,10 +70,8 @@ elements</a>.</p> | |||
| <p><code>junit</code> supports a nested <code><classpath></code> | |||
| element, that represents a <a href="index.html#path">PATH like | |||
| structure</a>. PATHs defined elsewhere can be <a | |||
| href="index.html#references">referred</a> to via nested | |||
| <code><classpathref></code> elements. The value is ignored if | |||
| <code>fork</code> is disabled.</p> | |||
| structure</a>. The value is ignored if <code>fork</code> is | |||
| disabled.</p> | |||
| <h4>jvmarg</h4> | |||
| @@ -80,7 +80,6 @@ public class Java extends Task { | |||
| private boolean fork = false; | |||
| private File dir = null; | |||
| private boolean failOnError = false; | |||
| private Vector classpathReferences = new Vector(); | |||
| /** | |||
| * Do the execution. | |||
| @@ -136,23 +135,14 @@ public class Java extends Task { | |||
| * Creates a nested classpath element | |||
| */ | |||
| public Path createClasspath() { | |||
| return cmdl.createClasspath(project); | |||
| return cmdl.createClasspath(project).createPath(); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| */ | |||
| public void addClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| * Adds a reference to a CLASSPATH defined elsewhere. | |||
| */ | |||
| public void setClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| createClasspath().setRefid(r); | |||
| } | |||
| /** | |||
| @@ -242,10 +232,7 @@ public class Java extends Task { | |||
| private void run(CommandlineJava command) throws BuildException { | |||
| ExecuteJava exe = new ExecuteJava(); | |||
| exe.setJavaCommand(command.getJavaCommand()); | |||
| Path p = new Path(project); | |||
| p.append(command.getClasspath()); | |||
| addReferencesToPath(classpathReferences, p); | |||
| exe.setClasspath(p); | |||
| exe.setClasspath(command.getClasspath()); | |||
| exe.execute(project); | |||
| } | |||
| @@ -279,33 +266,7 @@ public class Java extends Task { | |||
| for (int i=0; i<args.size(); i++) { | |||
| cmdj.createArgument().setValue((String) args.elementAt(i)); | |||
| } | |||
| if (cmdl.getClasspath() != null || classpathReferences.size() > 0) { | |||
| Path p = cmdj.createClasspath(project); | |||
| if (cmdl.getClasspath() != null) { | |||
| p.append(cmdl.getClasspath()); | |||
| } | |||
| addReferencesToPath(classpathReferences, p); | |||
| } | |||
| run(cmdj); | |||
| } | |||
| /** | |||
| * Appends the referenced Path instances to the other path. | |||
| * | |||
| * @param v Vector of Reference objects referring to Path objects. | |||
| * @param p Path to append to. | |||
| */ | |||
| private void addReferencesToPath(Vector v, Path p) { | |||
| for (int i=0; i<v.size(); i++) { | |||
| Reference r = (Reference) v.elementAt(i); | |||
| Object o = r.getReferencedObject(project); | |||
| if (o instanceof Path) { | |||
| p.append((Path) o); | |||
| } else { | |||
| String msg = r.getRefId()+" doesn\'t denote a classpath"; | |||
| throw new BuildException(msg, location); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -102,13 +102,11 @@ public class Javac extends MatchingTask { | |||
| private File destDir; | |||
| private Path compileClasspath; | |||
| private String encoding; | |||
| private Vector classpathReferences = new Vector(); | |||
| private boolean debug = false; | |||
| private boolean optimize = false; | |||
| private boolean deprecation = false; | |||
| private String target; | |||
| private Path bootclasspath; | |||
| private Vector bootClasspathReferences = new Vector(); | |||
| private Path extdirs; | |||
| private static String lSep = System.getProperty("line.separator"); | |||
| @@ -124,7 +122,7 @@ public class Javac extends MatchingTask { | |||
| if (src == null) { | |||
| src = new Path(project); | |||
| } | |||
| return src; | |||
| return src.createPath(); | |||
| } | |||
| /** | |||
| @@ -164,23 +162,14 @@ public class Javac extends MatchingTask { | |||
| if (compileClasspath == null) { | |||
| compileClasspath = new Path(project); | |||
| } | |||
| return compileClasspath; | |||
| return compileClasspath.createPath(); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| */ | |||
| public void addClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| * Adds a reference to a CLASSPATH defined elsewhere. | |||
| */ | |||
| public void setClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| createClasspath().setRefid(r); | |||
| } | |||
| /** | |||
| @@ -202,23 +191,14 @@ public class Javac extends MatchingTask { | |||
| if (bootclasspath == null) { | |||
| bootclasspath = new Path(project); | |||
| } | |||
| return bootclasspath; | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| */ | |||
| public void addBootClasspathRef(Reference r) { | |||
| bootClasspathReferences.addElement(r); | |||
| return bootclasspath.createPath(); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| * Adds a reference to a CLASSPATH defined elsewhere. | |||
| */ | |||
| public void setBootClasspathRef(Reference r) { | |||
| bootClasspathReferences.addElement(r); | |||
| createBootclasspath().setRefid(r); | |||
| } | |||
| /** | |||
| @@ -240,7 +220,7 @@ public class Javac extends MatchingTask { | |||
| if (extdirs == null) { | |||
| extdirs = new Path(project); | |||
| } | |||
| return extdirs; | |||
| return extdirs.createPath(); | |||
| } | |||
| /** | |||
| @@ -408,7 +388,6 @@ public class Javac extends MatchingTask { | |||
| if (compileClasspath != null) { | |||
| classpath.addExisting(compileClasspath); | |||
| } | |||
| addReferencesToPath(classpathReferences, classpath); | |||
| // add the system classpath | |||
| @@ -534,8 +513,7 @@ public class Javac extends MatchingTask { | |||
| if (optimize) { | |||
| cmd.createArgument().setValue("-O"); | |||
| } | |||
| if (bootclasspath != null || bootClasspathReferences.size() > 0) { | |||
| addReferencesToPath(bootClasspathReferences, createBootclasspath()); | |||
| if (bootclasspath != null) { | |||
| cmd.createArgument().setValue("-bootclasspath"); | |||
| cmd.createArgument().setPath(bootclasspath); | |||
| } | |||
| @@ -589,8 +567,7 @@ public class Javac extends MatchingTask { | |||
| // Jikes doesn't support bootclasspath dir (-bootclasspath) | |||
| // so we'll emulate it for compatibility and convenience. | |||
| if (bootclasspath != null || bootClasspathReferences.size() > 0) { | |||
| addReferencesToPath(bootClasspathReferences, createBootclasspath()); | |||
| if (bootclasspath != null) { | |||
| classpath.append(bootclasspath); | |||
| } | |||
| @@ -776,25 +753,6 @@ public class Javac extends MatchingTask { | |||
| } | |||
| } | |||
| /** | |||
| * Appends the referenced Path instances to the other path. | |||
| * | |||
| * @param v Vector of Reference objects referring to Path objects. | |||
| * @param p Path to append to. | |||
| */ | |||
| private void addReferencesToPath(Vector v, Path p) { | |||
| for (int i=0; i<v.size(); i++) { | |||
| Reference r = (Reference) v.elementAt(i); | |||
| Object o = r.getReferencedObject(project); | |||
| if (o instanceof Path) { | |||
| p.append((Path) o); | |||
| } else { | |||
| String msg = r.getRefId()+" doesn\'t denote a classpath"; | |||
| throw new BuildException(msg, location); | |||
| } | |||
| } | |||
| } | |||
| private void doJvcCompile() throws BuildException { | |||
| log("Using jvc compiler", Project.MSG_VERBOSE); | |||
| @@ -802,8 +760,7 @@ public class Javac extends MatchingTask { | |||
| // jvc doesn't support bootclasspath dir (-bootclasspath) | |||
| // so we'll emulate it for compatibility and convenience. | |||
| if (bootclasspath != null || bootClasspathReferences.size() > 0) { | |||
| addReferencesToPath(bootClasspathReferences, createBootclasspath()); | |||
| if (bootclasspath != null) { | |||
| classpath.append(bootclasspath); | |||
| } | |||
| @@ -120,7 +120,6 @@ public class Javadoc extends Task { | |||
| private Path path; | |||
| private Vector params = new Vector(); | |||
| private Vector pathRefs = new Vector(); | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| @@ -139,7 +138,6 @@ public class Javadoc extends Task { | |||
| } | |||
| public Path getPath() { | |||
| addReferencesToPath(pathRefs, path); | |||
| return path; | |||
| } | |||
| @@ -147,23 +145,14 @@ public class Javadoc extends Task { | |||
| if (path == null) { | |||
| path = new Path(getProject()); | |||
| } | |||
| return path; | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <pathref> element. | |||
| */ | |||
| public void addPathRef(Reference r) { | |||
| pathRefs.addElement(r); | |||
| return path.createPath(); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <pathref> element. | |||
| * Adds a reference to a CLASSPATH defined elsewhere. | |||
| */ | |||
| public void setPathRef(Reference r) { | |||
| pathRefs.addElement(r); | |||
| createPath().setRefid(r); | |||
| } | |||
| public DocletParam createParam() { | |||
| @@ -216,9 +205,6 @@ public class Javadoc extends Task { | |||
| private String packageList = null; | |||
| private Vector links = new Vector(2); | |||
| private Vector groups = new Vector(2); | |||
| private Vector classpathReferences = new Vector(); | |||
| private Vector bootClasspathReferences = new Vector(); | |||
| private Vector sourcepathReferences = new Vector(); | |||
| public void setMaxmemory(String max){ | |||
| if(javadoc1){ | |||
| @@ -243,22 +229,14 @@ public class Javadoc extends Task { | |||
| if (sourcePath == null) { | |||
| sourcePath = new Path(project); | |||
| } | |||
| return sourcePath; | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <sourcepathref> element. | |||
| */ | |||
| public void addSourcepathRef(Reference r) { | |||
| sourcepathReferences.addElement(r); | |||
| return sourcePath.createPath(); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <sourcepathref> element. | |||
| * Adds a reference to a CLASSPATH defined elsewhere. | |||
| */ | |||
| public void setSourcepathRef(Reference r) { | |||
| sourcepathReferences.addElement(r); | |||
| createSourcepath().setRefid(r); | |||
| } | |||
| public void setDestdir(File dir) { | |||
| @@ -306,7 +284,7 @@ public class Javadoc extends Task { | |||
| if (doclet == null) { | |||
| doclet = new DocletInfo(); | |||
| } | |||
| doclet.setPathRef(r); | |||
| doclet.createPath().setRefid(r); | |||
| } | |||
| public DocletInfo createDoclet() { | |||
| @@ -328,22 +306,14 @@ public class Javadoc extends Task { | |||
| if (classpath == null) { | |||
| classpath = new Path(project); | |||
| } | |||
| return classpath; | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| */ | |||
| public void addClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| return classpath.createPath(); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| * Adds a reference to a CLASSPATH defined elsewhere. | |||
| */ | |||
| public void setClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| createClasspath().setRefid(r); | |||
| } | |||
| public void setBootclasspath(Path src) { | |||
| @@ -357,22 +327,14 @@ public class Javadoc extends Task { | |||
| if (bootclasspath == null) { | |||
| bootclasspath = new Path(project); | |||
| } | |||
| return bootclasspath; | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <bootclasspathref> element. | |||
| */ | |||
| public void addBootClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| return bootclasspath.createPath(); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <bootclasspathref> element. | |||
| * Adds a reference to a CLASSPATH defined elsewhere. | |||
| */ | |||
| public void setBootClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| createBootclasspath().setRefid(r); | |||
| } | |||
| public void setExtdirs(String src) { | |||
| @@ -598,9 +560,6 @@ public class Javadoc extends Task { | |||
| if (classpath == null) | |||
| classpath = Path.systemClasspath; | |||
| addReferencesToPath(classpathReferences, classpath); | |||
| addReferencesToPath(sourcepathReferences, sourcePath); | |||
| if (!javadoc1) { | |||
| toExecute.createArgument().setValue("-classpath"); | |||
| toExecute.createArgument().setPath(classpath); | |||
| @@ -655,9 +614,7 @@ public class Javadoc extends Task { | |||
| } | |||
| } | |||
| } | |||
| if (bootclasspath != null || bootClasspathReferences.size() > 0) { | |||
| addReferencesToPath(bootClasspathReferences, | |||
| createBootclasspath()); | |||
| if (bootclasspath != null) { | |||
| toExecute.createArgument().setValue("-bootclasspath"); | |||
| toExecute.createArgument().setPath(bootclasspath); | |||
| } | |||
| @@ -781,25 +738,6 @@ public class Javadoc extends Task { | |||
| } | |||
| } | |||
| /** | |||
| * Appends the referenced Path instances to the other path. | |||
| * | |||
| * @param v Vector of Reference objects referring to Path objects. | |||
| * @param p Path to append to. | |||
| */ | |||
| private void addReferencesToPath(Vector v, Path p) { | |||
| for (int i=0; i<v.size(); i++) { | |||
| Reference r = (Reference) v.elementAt(i); | |||
| Object o = r.getReferencedObject(project); | |||
| if (o instanceof Path) { | |||
| p.append((Path) o); | |||
| } else { | |||
| String msg = r.getRefId()+" doesn\'t denote a classpath"; | |||
| throw new BuildException(msg, location); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Given a source path, a list of package patterns, fill the given list | |||
| * with the packages found in that path subdirs matching one of the given | |||
| @@ -97,19 +97,11 @@ public class Rmic extends MatchingTask { | |||
| private boolean filtering = false; | |||
| private Vector compileList = new Vector(); | |||
| private Vector classpathReferences = new Vector(); | |||
| public void setBase(String base) { | |||
| this.base = base; | |||
| } | |||
| public void XsetClass(String classname) { | |||
| log("The class attribute is deprecated. " + | |||
| "Please use the classname attribute.", | |||
| Project.MSG_WARN); | |||
| this.classname = classname; | |||
| } | |||
| public void setClassname(String classname) { | |||
| this.classname = classname; | |||
| } | |||
| @@ -122,8 +114,8 @@ public class Rmic extends MatchingTask { | |||
| this.stubVersion = stubVersion; | |||
| } | |||
| public void setFiltering(String filter) { | |||
| filtering = Project.toBoolean(filter); | |||
| public void setFiltering(boolean filter) { | |||
| filtering = filter; | |||
| } | |||
| /** | |||
| @@ -138,37 +130,28 @@ public class Rmic extends MatchingTask { | |||
| } | |||
| /** | |||
| * Maybe creates a nested classpath element. | |||
| * Creates a nested classpath element. | |||
| */ | |||
| public Path createClasspath() { | |||
| if (compileClasspath == null) { | |||
| compileClasspath = new Path(project); | |||
| } | |||
| return compileClasspath; | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| */ | |||
| public void addClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| return compileClasspath.createPath(); | |||
| } | |||
| /** | |||
| * Adds a reference to a CLASSPATH defined elsewhere - nested | |||
| * <classpathref> element. | |||
| * Adds a reference to a CLASSPATH defined elsewhere. | |||
| */ | |||
| public void setClasspathRef(Reference r) { | |||
| classpathReferences.addElement(r); | |||
| createClasspath().setRefid(r); | |||
| } | |||
| /** | |||
| * Indicates that the classes found by the directory match should be | |||
| * checked to see if they implement java.rmi.Remote. | |||
| * This defaults to false if not set. */ | |||
| public void setVerify(String verify) { | |||
| this.verify = Project.toBoolean(verify); | |||
| public void setVerify(boolean verify) { | |||
| this.verify = verify; | |||
| } | |||
| public void execute() throws BuildException { | |||
| @@ -189,18 +172,6 @@ public class Rmic extends MatchingTask { | |||
| } | |||
| Path classpath = getCompileClasspath(baseDir); | |||
| 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); | |||
| } | |||
| } | |||
| // scan base dirs to build up compile lists only if a | |||
| // specific classname is not given | |||
| if (classname == null) { | |||
| @@ -406,45 +377,21 @@ public class Rmic extends MatchingTask { | |||
| // add our classpath to the mix | |||
| if (compileClasspath != null) { | |||
| addExistingToClasspath(classpath,compileClasspath); | |||
| classpath.addExisting(compileClasspath); | |||
| } | |||
| // add the system classpath | |||
| addExistingToClasspath(classpath, Path.systemClasspath); | |||
| classpath.addExisting(Path.systemClasspath); | |||
| // in jdk 1.2, the system classes are not on the visible classpath. | |||
| if (Project.getJavaVersion().startsWith("1.2")) { | |||
| String bootcp = System.getProperty("sun.boot.class.path"); | |||
| if (bootcp != null) { | |||
| addExistingToClasspath(classpath, new Path(project, bootcp)); | |||
| classpath.addExisting(new Path(project, bootcp)); | |||
| } | |||
| } | |||
| return classpath; | |||
| } | |||
| /** | |||
| * Takes a classpath-like string, and adds each element of | |||
| * this string to a new classpath, if the components exist. | |||
| * Components that don't exist, aren't added. | |||
| * We do this, because jikes issues warnings for non-existant | |||
| * files/dirs in his classpath, and these warnings are pretty | |||
| * annoying. | |||
| * @param target - target classpath | |||
| * @param source - source classpath | |||
| * to get file objects. | |||
| */ | |||
| private void addExistingToClasspath(Path target, Path source) { | |||
| String[] list = source.list(); | |||
| for (int i=0; i<list.length; i++) { | |||
| File f = project.resolveFile(list[i]); | |||
| if (f.exists()) { | |||
| target.setLocation(f); | |||
| } else { | |||
| log("Dropping from classpath: "+ | |||
| f.getAbsolutePath(), Project.MSG_VERBOSE); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -88,7 +88,6 @@ 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(); | |||
| @@ -134,16 +133,8 @@ 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); | |||
| return commandline.createClasspath(project).createPath(); | |||
| } | |||
| public void addTest(JUnitTest test) { | |||
| @@ -180,19 +171,6 @@ 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(); | |||