ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject RE: Scope of Types
Date Tue, 05 Jun 2001 14:33:26 GMT
At 01:19 PM 6/5/01 +0100, Jose Alberto Fernandez wrote:
>> From: Stefan Bodewig []
>> Jose Alberto Fernandez <> wrote:
>> > Well, the current rules would require <projectref> to allow for a
>> > <A:mailaddressset> element. But you cannot have it because is
>> > dynamically generated.
>> Right, this is one (the?) major drawback of not collecting all
>> data-types under one construct (be it Peter's <set-item> or an unified
>> <property> or whatever).  This is the outcome of the vote, and we have
>> to live with it - but somehow <ant*> and <projectref> will need to
>> deal with non-String properties.
>Well, even politicians change their minds. :-)
>Maybe if someone makes a proper case the matter can be re-voted. Was the
>original vote based on some very strong arguments or was just a go with flow
>kind of vote? I really have no recollection.

IIRC it was vetoed by Conor because it was too generic and didn't buildfile
user anything (only task file writer) - at least that was I believe the
reason. I kinda agree with it too.

>If we come to believe, given the current more concrete picture, that
>architecturally it would be better to do something different from what was
>voted, I do not see why this cannot be discussed.

There is actually a nice way to do it that I have been playing with
recently. It is a side-effect of AbstractContainerTask. The
AbstractContainerTask is passed TaskModel. It strips the attribute name out
of top-level element and then uses remainder of TaskModel to configure the
data type. The name of the datatype (as used to create instance from
TypeRegistry) is same as name for task. 

So lets assume the following

<fileset name="foo" dir="blah">
  <include name=".../>

And lets assume that above that there is definition 

<datadef name="fileset" class="org.apache.ant.framework.FileSet"/>
<taskdef name="fileset" class="org.apache.ant.framework.TypeInstanceTask"/>

The task would first identify that name of task is 'fileset' and thus it
would look that up in type registry and create an instance of 'fileset'
datatype. It would then extract top-level attribute 'name' from TaskModel
(the value of which is 'foo'). It would then use remaining part of
TaskModel to configure the instance. if that is successful it would
setProperty("foo", fileset ).

Creating new datatypes and coresponding class would be as simple as

<datadef name="patternset" class="org.apache.ant.framework.PatternSet"/>
<taskdef name="patternset" class="org.apache.ant.framework.TypeInstanceTask"/>

Easy to implement and easy on user. So in a way I like it. Slightly extra
work (an extra typedef per datatype) but well worth it in my opinion.



| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |

View raw message