ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject Re: ScriptDef
Date Fri, 15 Feb 2002 11:53:17 GMT
Jose Alberto Fernandez wrote:

>>On Fri, 15 Feb 2002 10:44, Conor MacNeill wrote:
>>>In addition, the way I implemented <scriptdef> it can support nested
>>>elements, which are potentially repeated
>>>    <fileset ...>
>>>    <fileset ...>
>>>It is hard to support that capability with simple named parameters.
> I really like it. Besides the fact that the syntax is consistent with the rest of ANT,
> it really allows for te users of the task not to know how the task was written.
> And given the fact than in ANT2 one is able to import/include other project files
> the users of this task may be different from the person that develops it.
> I would like to support this kind of thing in ANT1. Connor, can you tell us how do you
> do to introspect the class? What would need to be different to make it possible in ANT1?

Jose Alberto,

The basic mechanism is an interface called DeferredTask. Tasks which 
implement this interface are not introspected in the normal way. Rather, 
the attributes and nested elements are passed into this task for its 
later use. It is not quite the same as passing in the build model since 
the nested elements will have been resolved to their execution time 
counterparts by the core.

At execution time the deferred task can make use of its elements and 
attributes. The ScriptBase class which actually implements the script 
execution firstly evaluates the basic script definition, then simply 
forms function names from the various attributes and nested elements and 
call these functions. Finally it calls an execute function

Mutant provides a few other facilities to allow the ScriptDef task and 
the ScriptBase class to "communicate" information, such as the script 
text. Primarily this is a factory object associated with the use of the 
antlib in an execution frame. In Ant1, this sort of shared context is 
normally provided for in the Project object.

To do this sort of thing in Ant1, you are going to need to play games in 
UnknownElement and RuntimeConfigurable. In many ways these two classes 
are closer to the way mutant (and I guess myrmidon, also) does things so 
it may be possible, although you need to wear a hard hat.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message