costin 2002/12/24 10:09:39
Modified: src/main/org/apache/tools/ant/taskdefs Classloader.java
src/etc/testcases/taskdefs classloader.xml
Log:
Use classpath instead of path.
Allow more convenient specification of the classpath.
Revision Changes Path
1.2 +26 -6
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Classloader.java
Index: Classloader.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Classloader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Classloader.java 24 Dec 2002 01:27:45 -0000 1.1
+++ Classloader.java 24 Dec 2002 18:09:39 -0000 1.2
@@ -112,7 +112,7 @@
public static final String SYSTEM_LOADER_REF="ant.coreLoader";
private String name=null;
- private Path path;
+ private Path classpath;
private boolean reset=false;
private boolean reverse=false;
private String parentName=null;
@@ -156,8 +156,28 @@
* and is an AntClassLoader ( or any other loader we can extend ),
* the path will be added to the loader.
*/
- public void setPathRef( Reference pathRef ) throws BuildException {
- path=(Path)pathRef.getReferencedObject(project);
+ public void setClasspathRef( Reference pathRef ) throws BuildException {
+ classpath=(Path)pathRef.getReferencedObject(project);
+ }
+
+ /**
+ * Set the classpath to be used when searching for component being
defined
+ *
+ * @param classpath an Ant Path object containing the classpath.
+ */
+ public void setClasspath(Path classpath) {
+ if (this.classpath == null) {
+ this.classpath = classpath;
+ } else {
+ this.classpath.append(classpath);
+ }
+ }
+
+ public Path createClasspath() {
+ if (this.classpath == null) {
+ this.classpath = new Path(null);
+ }
+ return this.classpath.createPath();
}
@@ -204,7 +224,7 @@
}
acl=new AntClassLoader( (ClassLoader)parent,
- project, path, reverse );
+ project, classpath, reverse );
project.addReference( loaderName, acl );
if( name==null ) {
// This allows the core loader to load optional tasks
@@ -213,8 +233,8 @@
project.setCoreLoader(acl);
}
}
- if( path != null ) {
- String list[]=path.list();
+ if( classpath != null ) {
+ String list[]=classpath.list();
for( int i=0; i<list.length; i++ ) {
File f= new File( list[i] );
if( f.exists() ) {
1.2 +1 -1 jakarta-ant/src/etc/testcases/taskdefs/classloader.xml
Index: classloader.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/classloader.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- classloader.xml 24 Dec 2002 01:21:26 -0000 1.1
+++ classloader.xml 24 Dec 2002 18:09:39 -0000 1.2
@@ -8,7 +8,7 @@
<pathelement path="${junit.jar}" />
</path>
- <classloader pathRef="myJars"
+ <classloader classpathRef="myJars"
reverse="true" >
</classloader>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>