You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2002/11/21 23:42:20 UTC

cvs commit: jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs SystemPath.java

costin      2002/11/21 14:42:20

  Modified:    proposal/embed/src/java/org/apache/tools/ant/taskdefs
                        SystemPath.java
  Log:
  Allow multiple <systemPath> ( system path is used to add more stuff
  to the 'main' loader - for example to add junit.jar so that
  <junit> optional task can work )
  
  Revision  Changes    Path
  1.3       +13 -8     jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/SystemPath.java
  
  Index: SystemPath.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/taskdefs/SystemPath.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SystemPath.java	27 Jul 2002 02:19:27 -0000	1.2
  +++ SystemPath.java	21 Nov 2002 22:42:19 -0000	1.3
  @@ -120,24 +120,29 @@
        */
       private void initSystemLoader(Path path) {
           try {
  -            if( project.getReference( SYSTEM_LOADER_REF ) != null )
  -                return; // already done that.
  +            //if( project.getReference( SYSTEM_LOADER_REF ) != null )
  +            //    return; // already done that.
               
               // reverse loader
  -            AntClassLoader acl=new AntClassLoader( this.getClass().getClassLoader(), true );
  -            acl.addLoaderPackageRoot( "org.apache.tools.ant.taskdefs.optional");
  -            project.addReference( SYSTEM_LOADER_REF, acl );
  -            
  -            
  +            AntClassLoader acl=(AntClassLoader)project.getReference(SYSTEM_LOADER_REF);
  +            if( acl==null ) {
  +                acl=new AntClassLoader( this.getClass().getClassLoader(), true );
  +                acl.addLoaderPackageRoot( "org.apache.tools.ant.taskdefs.optional");
  +                project.addReference( SYSTEM_LOADER_REF, acl );
  +            }
  +
  +
               String list[]=path.list();
               for( int i=0; i<list.length; i++ ) {
                   File f= new File( list[i] );
                   if( f.exists() ) {
                       acl.addPathElement(f.getAbsolutePath());
  +                    log("Adding to class loader " +  acl + " " + f.getAbsolutePath(),
  +                        Project.MSG_DEBUG);
                   }
               }
               
  -            // XXX find the classpath
  +            // XXX find the classpath - add the optional jars.
               String antHome=project.getProperty( "ant.home" );
               File optionalJar=new File( antHome + "/lib/optional.jar" );
               if( optionalJar.exists() )
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>