ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpfoe...@ThoughtWorks.com
Subject Re: Ant Principles
Date Wed, 19 Apr 2000 20:55:56 GMT

Has any thought been given to bundling tasks together so that they can be
loaded as a group? For example, if a build file contained the following...

<project name="foo">
    <load module="jdk" />
    <load module="cvs" />
    ...
</project>

...we could have Ant load all of the tasks defined in the "jdk" module
(which would include things like javac, jar, rmic, etc) and the "cvs"
module (which would include things like checkout, diff, etc) and make them
available as tasks.  If it were this easy to load sets of taskdefs, it by
be worth doing this for *all* taskdefs, and eliminate the distinction
between "optional" and "standard" taskdefs...

So if we want to go this route, the next question is how to bundle the
taskdefs into modules. A lot of the proposals I've seen haven't dealt with
the fact that a taskdef may depend on multiple other jars to get its job
done (javac needs the tools.jar, for example). So let's assume that a
module is actually a collection of jars, one of which contains a
"tasks.properties" file, which maps task names to class names (same format
as the current defaults.properties file). We could then create a
modules.properties file in the ANT_HOME directory (or where ever) that
looked like:

jdk=/jdk1.2.2/lib/tools.jar:lib/ant-jdk.jar
cvs=lib/ant-cvs.jar
 ...

When a build file loads the "jdk" module, for example, Ant will create a
class loader to load classfiles from /jdk1.2.2/lib/tools.jar  and
lib/ant-jdk.jar (paths would be relative to the location of the
modules.properties file).  From this classloader we could load the
"tasks.properties" file as a resource, and instantiate the proper classes .
We could then load the taskdefs from the classloader.

For the case where projects define their own taskdefs that don't really
need to be "installed" on the users machine, we can offer an alternate
syntax for the load statement. The following will basically create an
"anonymous" module (using the ant-special.jar and utils.jar, both in the
lib directory) and load it on the fly:

<load classpath="lib/ant-special.jar:lib/utils.jar"/>

thoughts?

Matt Foemmel
ThoughtWorks, Inc.


Mime
View raw message