ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/proposal/sandbox/antlib/src/main/org/apache/tools/ant Project.java antlib.xml
Date Fri, 11 Apr 2003 13:54:48 GMT
bodewig     2003/04/11 06:54:47

  Modified:    proposal/sandbox/antlib/src/main/org/apache/tools/ant
                        Project.java antlib.xml
  Log:
  More syncing of the antlib proposal with the main code line.
  
  Submitted by:	Antoine Levy-Lambert <levylambert at tiscali dash dsl dot de>
  
  Revision  Changes    Path
  1.6       +49 -0     ant/proposal/sandbox/antlib/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/ant/proposal/sandbox/antlib/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Project.java	1 Apr 2003 11:35:06 -0000	1.5
  +++ Project.java	11 Apr 2003 13:54:47 -0000	1.6
  @@ -70,6 +70,7 @@
   import org.apache.tools.ant.types.FilterSetCollection;
   import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.ant.util.LazyHashtable;
  +import org.apache.tools.ant.util.JavaEnvUtils;
   import org.apache.tools.ant.types.Path;
   import org.apache.tools.ant.taskdefs.Antlib;
   import org.apache.tools.ant.input.InputHandler;
  @@ -133,6 +134,13 @@
       private static String javaVersion;
   
       /**
  +     * The class name of the Ant class loader to use for
  +     * JDK 1.2 and above
  +     */
  +    private static final String ANTCLASSLOADER_JDK12
  +        = "org.apache.tools.ant.loader.AntClassLoader2";
  +
  +    /**
        *  Description of the Field
        */
       public final static String JAVA_1_0 = "1.0";
  @@ -462,6 +470,47 @@
           }
       }
   
  +
  +    /**
  +     * Factory method to create a class loader for loading classes
  +     *
  +     * @return an appropriate classloader
  +     */
  +    private AntClassLoader createClassLoader() {
  +        AntClassLoader loader = null;
  +        if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
  +            try {
  +                // 1.2+ - create advanced helper dynamically
  +                Class loaderClass
  +                    = Class.forName(ANTCLASSLOADER_JDK12);
  +                loader = (AntClassLoader) loaderClass.newInstance();
  +            } catch (Exception e) {
  +                    log("Unable to create Class Loader: "
  +                        + e.getMessage(), Project.MSG_DEBUG);
  +            }
  +        }
  +
  +        if (loader == null) {
  +            loader = new AntClassLoader();
  +        }
  +
  +        loader.setProject(this);
  +        return loader;
  +    }
  +
  +    /**
  +     * Factory method to create a class loader for loading classes from
  +     * a given path
  +     *
  +     * @param path the path from whcih clases are to be loaded.
  +     *
  +     * @return an appropriate classloader
  +     */
  +    public AntClassLoader createClassLoader(Path path) {
  +        AntClassLoader loader = createClassLoader();
  +        loader.setClassPath(path);
  +        return loader;
  +    }
   
       /**
        *  Sets the coreLoader attribute of the Project object
  
  
  
  1.2       +8 -0      ant/proposal/sandbox/antlib/src/main/org/apache/tools/ant/antlib.xml
  
  Index: antlib.xml
  ===================================================================
  RCS file: /home/cvs/ant/proposal/sandbox/antlib/src/main/org/apache/tools/ant/antlib.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- antlib.xml	2 Mar 2002 22:21:19 -0000	1.1
  +++ antlib.xml	11 Apr 2003 13:54:47 -0000	1.2
  @@ -122,9 +122,17 @@
     <data-type name="patternset" class="org.apache.tools.ant.types.PatternSet"/>
     <data-type name="mapper" class="org.apache.tools.ant.types.Mapper"/>
     <data-type name="filterset" class="org.apache.tools.ant.types.FilterSet"/>
  +  <data-type name="filterchain" class="org.apache.tools.ant.types.FilterChain" />
  +  <data-type name="filterreader" class="org.apache.tools.ant.types.AntFilterReader"
/>
     <data-type name="description" class="org.apache.tools.ant.types.Description"/>
     <data-type name="substitution" class="org.apache.tools.ant.types.Substitution"/>
     <data-type name="regexp" class="org.apache.tools.ant.types.RegularExpression"/>
  +  <data-type name="selector" class="org.apache.tools.ant.types.selectors.SelectSelector"/>
  +  <data-type name="zipfileset" class="org.apache.tools.ant.types.ZipFileSet"/>
  +  <data-type name="xmlcatalog" class="org.apache.tools.ant.types.XMLCatalog" />
  +  <data-type name="extensionSet" class="org.apache.tools.ant.taskdefs.optional.extension.ExtensionSet"
/>
  +  <data-type name="extension" class="org.apache.tools.ant.taskdefs.optional.extension.ExtensionAdapter"
/>
  +  <data-type name="libfileset" class="org.apache.tools.ant.taskdefs.optional.extension.LibFileSet"
/>
   
     <!-- deprecated ant tasks (kept for back compatibility) -->
   
  
  
  

Mime
View raw message