From ff810113da688cd4aa875ac5bb4ddea3863a9f53 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 6 Sep 2000 14:05:00 +0000 Subject: [PATCH] Removed all nested elements in favor of . git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267970 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 12 +-- docs/index.html | 32 +++---- docs/junit.html | 6 +- .../org/apache/tools/ant/taskdefs/Java.java | 47 +--------- .../org/apache/tools/ant/taskdefs/Javac.java | 65 +++----------- .../apache/tools/ant/taskdefs/Javadoc.java | 90 +++---------------- .../org/apache/tools/ant/taskdefs/Rmic.java | 75 +++------------- .../taskdefs/optional/junit/JUnitTask.java | 24 +---- 8 files changed, 61 insertions(+), 290 deletions(-) diff --git a/build.xml b/build.xml index f51a8fe9f..e95bd9db2 100644 --- a/build.xml +++ b/build.xml @@ -27,7 +27,8 @@ - + + @@ -79,10 +80,11 @@ + + @@ -282,7 +284,7 @@ optimize="on" > - + @@ -308,7 +310,7 @@ - + @@ -328,7 +330,7 @@ - + diff --git a/docs/index.html b/docs/index.html index 36d6cf078..9cec43182 100644 --- a/docs/index.html +++ b/docs/index.html @@ -573,13 +573,13 @@ example.

<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.

Use nested <arg> and <jvmarg> elements to specify arguments for the or the forked VM. See Command line arguments.

-

classpath and classpathref

+

classpath

Java's classpath attribute is a PATH like structure and can also be set via a nested -classpath element. PATHs defined elsewhere can be -referred to via nested classpathref -elements.

+classpath element.

Example
  
        <java classname="test.Main" >
@@ -2429,14 +2427,12 @@ supports all attributes of <fileset>
 <include>, <exclude>,
 <patternset> and <patternsetref>
 elements.

-

src, classpath, classpathref, bootclasspath, bootclasspathref and extdirs

+

src, classpath, bootclasspath and extdirs

Javac's srcdir, classpath, bootclasspath and extdirs attributes are PATH like structure and can also be set via nested src, classpath, bootclasspath and -extdirs elements respectively. PATHs defined elsewhere can be -referred to via nested classpathref -and bootclasspathref elements.

+extdirs elements respectively.

Examples

  <javac srcdir="${src}"
@@ -2525,8 +2521,7 @@ instead.

Specify where to find source files all At least one of the two or nested - <sourcepath> or - <sourcepathref> + <sourcepath> sourcepathref @@ -2885,15 +2880,12 @@ arguments.

-

sourcepath, classpath, bootclasspath, sourcepathref, classpathref -and bootclasspathref

+

sourcepath, classpath and bootclasspath

Javadoc's sourcepath, classpath and bootclasspath attributes are PATH like structure and can also be set via nested sourcepath, classpath and bootclasspath elements -respectively. PATHs defined elsewhere can be referred to via nested sourcepathref, -classpathref and bootclasspathref elements.

+respectively.

Example

  <javadoc packagenames="com.dummy.test.*"
@@ -3300,12 +3292,10 @@ elements.

Parameters specified as nested elements

-

classpath and classpathref

+

classpath

Rmic's classpath attribute is a PATH like structure and can also be set via a nested -classpath elements. PATHs defined elsewhere can be -referred to via nested classpathref -elements.

+classpath elements.

Examples

  <rmic classname="com.xyz.FooBar" base="${build}/classes" />

runs the rmic compiler for the class com.xyz.FooBar. The diff --git a/docs/junit.html b/docs/junit.html index 40aaec2c6..1be50e8d2 100644 --- a/docs/junit.html +++ b/docs/junit.html @@ -70,10 +70,8 @@ elements.

junit supports a nested <classpath> element, that represents a PATH like -structure. PATHs defined elsewhere can be referred to via nested -<classpathref> elements. The value is ignored if -fork is disabled.

+structure. The value is ignored if fork is +disabled.

jvmarg

diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java index 3ecdff21f..f7474aa9b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -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 - * element. - */ - public void addClasspathRef(Reference r) { - classpathReferences.addElement(r); - } - - /** - * Adds a reference to a CLASSPATH defined elsewhere - nested - * 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 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 element. - */ - public void addClasspathRef(Reference r) { - classpathReferences.addElement(r); - } - - /** - * Adds a reference to a CLASSPATH defined elsewhere - nested - * 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 - * element. - */ - public void addBootClasspathRef(Reference r) { - bootClasspathReferences.addElement(r); + return bootclasspath.createPath(); } /** - * Adds a reference to a CLASSPATH defined elsewhere - nested - * 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 0) { - addReferencesToPath(bootClasspathReferences, createBootclasspath()); + if (bootclasspath != null) { classpath.append(bootclasspath); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index 79655024b..a16f00e7f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -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 - * element. - */ - public void addPathRef(Reference r) { - pathRefs.addElement(r); + return path.createPath(); } /** - * Adds a reference to a CLASSPATH defined elsewhere - nested - * 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 - * element. - */ - public void addSourcepathRef(Reference r) { - sourcepathReferences.addElement(r); + return sourcePath.createPath(); } /** - * Adds a reference to a CLASSPATH defined elsewhere - nested - * 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 - * element. - */ - public void addClasspathRef(Reference r) { - classpathReferences.addElement(r); + return classpath.createPath(); } /** - * Adds a reference to a CLASSPATH defined elsewhere - nested - * 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 - * element. - */ - public void addBootClasspathRef(Reference r) { - classpathReferences.addElement(r); + return bootclasspath.createPath(); } /** - * Adds a reference to a CLASSPATH defined elsewhere - nested - * 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 element. - */ - public void addClasspathRef(Reference r) { - classpathReferences.addElement(r); + return compileClasspath.createPath(); } /** - * Adds a reference to a CLASSPATH defined elsewhere - nested - * 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 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