ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: Scope of Types
Date Tue, 05 Jun 2001 15:02:35 GMT
> From: Peter Donald []
> 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=".../>
>   ...
> </fileset>
> 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.

So how does this work for a task like <javac> that has a Path for the
classpath and another Path for the src path. Do I need to declare the values
before using them int he task? Can it be substitured in place?

How can I pass a type-value as a parameter to <ant*> I probably do not want
to have to declare the value since I do not want a binding created on the
calling project.

I think that is where the pickle of the problem is.

Jose Alberto

View raw message