ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <j_a_fernan...@yahoo.com>
Subject RE: Descriptor Format
Date Sun, 03 Jun 2001 12:07:05 GMT
> From: Peter Donald [mailto:donaldp@apache.org]
>
> Hi,
>
> I think we are closer to defining the format for descriptor file. The
> problem is that we have an open set of components that each
> descriptor file
> must be able to describe. For isntance we currently have settled on at
> least the following types being stored in jars;
> * Mappers
> * Tasks
> * DataTypes (and sub-classes like FileSet/FTPFileSet/ZipFileSet).
> * Aspects
> * Listeners
> * Converters
>
> We need some way to be able to register all these different types.
> Excluding converter for the moment, all of them have similar
> attributes
> that need to be placed in TypeRegistry (ie Type + name + className).
>
> A pattern that originated with Cocoon2 (which has similar
> requirements) is
> to have two types of data in XML. The first type looks like
>
> <type name="task" interface="org.apache.ant.api.Task"/>
> <type name="data-type" interface="org.apache.ant.api.DataType"/>
> <type name="mapper" interface="org.apache.ant.framework.Mapper"/>
>
> It maps a short-hand name to a Type/Role name. The second
> type looks like
>
> <task name="javac" class="org.apache.ant.tasks.jdk.Javac"/>
> <task name="java" class="org.apache.ant.tasks.jdk.Java"/>
>
> <data-type name="classpath"
> class="org.apache.ant.tasks.jdk.Classpath"/>
> <data-type name="fileset" class="org.apache.ant.tasks.file.FileSet"/>
> <data-type name="zip-fileset"
> class="org.apache.ant.tasks.file.ZipFileSet"/>
>
> <mapper name="glob"
> class="org.apache.ant.framework.mappers.GlobMapper"/>
>
> and this maps name to classes that match a certain role. ie
> The following
> two representations are basically equivelent
>
> <mapper name="glob"
> class="org.apache.ant.framework.mappers.GlobMapper"/>
>
> <item  name="glob"
>        interface="org.apache.ant.framework.Mapper"
>        class="org.apache.ant.framework.mappers.GlobMapper"/>
>
> but the first is easier to read.
>
> I propose that the descriptor format looks like -
>
> <task name="javac" class="org.apache.ant.tasks.jdk.Javac"/>
> <task name="java" class="org.apache.ant.tasks.jdk.Java"/>
>
> <data-type name="classpath"
> class="org.apache.ant.tasks.jdk.Classpath"/>
> <data-type name="fileset" class="org.apache.ant.tasks.file.FileSet"/>
> <data-type name="zip-fileset"
> class="org.apache.ant.tasks.file.ZipFileSet"/>
>
> <mapper name="glob"
> class="org.apache.ant.framework.mappers.GlobMapper"/>
>

Not to be picky, but I suggest we try to keep some similarity with ANT1 name
usages if at all possible, so that we do not shock users too much:
<taskdef>, <typedef>, etc.

> It is easy to read and write and expressive enough for most
> concerns. If we
> ever across a need for parameterized types (which I am not
> sure we will) we
> can always change format to look like
>
> <mapper name="glob"
> class="org.apache.ant.framework.mappers.GlobMapper">
>   <parameter name="foo" value="bar" />
> </mapper>
>
> However I am not sure we will ever need this.
>
I would like to have the same syntax (whatever that is) for antlib.xml and
for loose declarations in the buildfile itself. There is no reason to
confuse people more than necessary ;-)

With that in mind, we need to make allowance for declaring <classpath> on
the <task(def)>  declaration, so I can compile and use a loose task in one
go. I presume simmilar requirements apply to others.

> The first set of information
>
> <type name="task" interface="org.apache.ant.api.Task"/>
> <type name="data-type" interface="org.apache.ant.api.DataType"/>
> <type name="mapper" interface="org.apache.ant.framework.Mapper"/>
>
> will be stored in regular jars that are sucked into base
> ClassLoader. The
> reason is that the interfaces have to come from common jars
> that all tasks
> have access to and it seems good to keep information about
> interface in one
> place.
>

This makes sense, you could think of them belonging to the CORE. If on some
specialized usage of ANT's engine, (e.g. 3d rendering) you need some other
types, you can added to its CORE.

Jose Alberto


Mime
View raw message