ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <adammurdoch...@yahoo.com>
Subject RE: <antlib> (was RE: Ant 1.9 & Task Packaging)
Date Thu, 24 Jan 2002 00:32:42 GMT


> -----Original Message-----
> From: Steve Loughran [mailto:steve_l@iseran.com]
> Sent: Thursday, 24 January 2002 10:01 AM
> To: Ant Developers List
> Subject: Re: <antlib> (was RE: Ant 1.9 & Task Packaging)
>
>
> >
> > So what's holding us back with implementing <antlib>? There were some
> > proposals a while back but nothing ever really happened with them, it
> seemed
> > there was some concern about forward-compatibility with Ant2 - is that
> still
> > the concern?
>
>
> Jose Alberto's implementation is in the sandbox; works with today's builds
> and includes the descriptor generation task as well as the loading task.
>
> But to go into the main codebase there has to be widespread
> happiness about
> the descriptor and the process for declaring it.
>
> I agree with your critique of the Condition task BTW, Tim, it should not
> need a code change to add a new conditional test, or to add a new EJB back
> end. Which makes me thing we may even need a very generic descriptor, one
> which doesnt list tasks so much as list implementations of interfaces
>
>
> <implements interface="org.apache.tools.ant.interfaces.Taskable">
>  <implementation
>     name="DeleteRandomFiles"
>     class="org.someone.MyClass"
>     description="delete random files"
>     failuretext="you need cryptographicallyStrongRNG.jar" />
> </implements>
> <implements interface="org.apache.tools.ant.interfaces.Conditional">
>  <implementation name="maybe" description="sometimes succeeds"
> class="org.someone.Maybe/>
> </implements>
> <implements interface="org.apache.tools.ant.interfaces.EjbBackEnd">
>  ...
> </implements>
>

Myrmidon does something very similar, though the layout is a little nicer.

Myrmidon uses the term 'role' for the interface or abstract type, and the
term 'type' for a concrete implementation of that role.  The declarations
for roles are separate from the declarations for types, so the
implementations can be spread across more than one typelib.

Roles are declared like this:

<roles>
    <role shorthand="condition" name="org.apache.antlib.types.Conditional"/>
    <role shorthand="task" name="org.apache.ant.interfaces.Task"/>
</roles>

Types are declared like this:

<types>
    <condition name="is-set"
classname="org.apache.antlib.types.PropIsSetCondition"/>
    <condition name="equals"
classname="org.apache.antlib.types.PropEqualsCondition"/>
    <task name="javac" classname="org.apache.antlib.tasks.javac.Javac"/>
</types>

A role declaration would typically be added to the descriptor of the typelib
that contains the interface.  Then, any other typelib can use that role in
its own descriptor.  For example, if a core typelib declares the "condition"
role, then I can write my own typelib, and declare my own "condition"
implementations by simply adding <condition name="" classname=""/> to my
typelib's descriptor.

This is quite a nice generalisation, regardless of whether you like the term
'role' or not.


Adam


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message