Sorry for asking for another vote on the Classloader for ant issue,
but I think that the last vote was very half-hearted in slight support
of including the (new) classloader task. However, I think that there
was not enough support. In the meantime, I have
been looking at Jesse's idea to have a "secondary" classloader
that is used to load antlibs and optional tasks. I presented an
initial implemention (see the "classloader for 1.7" subject).

This does the following:
1)  A new classloader is created for loading tasks/types:
      * componentClassLoader
    The parent of this loader in the normal Project loader.
2) This is initializes with the jars containing ant's optional
    tasks/types
3) The componentClassLoader will be a normal AntTaskLoader
    (parentFirst), except for classes in o.a.t.a.taskdefs.optional
    and o.t.a.types.optional, for these the classloader will load
    from this classloader first. (This is like the way the SplitLoader
    works in JUnitTask).
4) A task will be provided to allow ant scripts to add jars/directories
   to the componentClassLoader - possible name <addlibpath>
5) This compoentClassLoader will be inherited by subprojects
    created by <ant>, <antcall> and <subant>.

A build script will look something like this:

<project xmlns:ac="antlib:net.sf.antcontrib">
       <property environment="env"/>

       <!-- test for ant optional task - jdepend -->
       <addlibpath>
           <fileset dir="${env.JDEPEND_HOME}/lib"/>
       </addlibpath>

       <jdepend>
           <classespath path="build/classes"/>
       </jdepend>

       <!-- test for ant lib -->
       <addlibpath>
           <fileset dir="${user.home}/ant-contrib"
includes="ant-con*.jar"/>
       </addlibpath>

       <ac:for param="param" list="a,b,c">
           <sequential>
             <echo>@{param}</echo>
           </sequential>
       </ac:for>

       <!-- test for script -->
       <addlibpath>
           <fileset dir="${user.home}/lang/bsf" includes="*.jar"/>
           <fileset dir="${user.home}/lang/beanshell" includes="*.jar"/>
       </addlibpath>

       <script language="beanshell">
           System.out.println("Hello world");
       </script>
</project>


Vote:
 yes this is a good thing for 1.7 [  ]
 no,  let us stabilize 1.7            [  ]

Reply via email to