ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Alberto Fernandez <JFernan...@viquity.com>
Subject RE: Some Thoughts on Ant 1.3 and 2.0
Date Fri, 27 Oct 2000 22:41:24 GMT
> From: Vincent Bergbauer [mailto:vincent_bergbauer@yahoo.com]
> 
> What you describe is a template mechanism. 
> It is very useful, but it is not that easy to implement.
> 
> My submission was more modest in scope:
>   It allows an Argument to be shared like a PatternSet or a FileSet.
>   It also allows transformations between argument and path.
> 
> Obviously it is not anywhere as powerful as a template,
> but it requires only modest changes to Ant and it is still useful:
> 
> <argset id="mydefinitions">
>   <arg value="-Dsecurity.policy" />
>   <arg value="-Djava.security.policy=${config.dir}/${policy.name}"/>
> </argset>
> 
>  <target ... >
>    <java ...>
>      <jvmarg refid="mydefinitions"/>
>    </java>
>  </target>
> 
> 
> Note that your example already uses a reference to path 
> <classpath refid="..." />. 
> This is not all that different from a reference to an argument, is it?
> 
> I'll make you that promise: I will look at a possible 
> implementation of taskdef, 
> and if does not require rewriting half of Ant core or adding 
> huge amount of code,
> it may yet show up in one of my submissions.
> 

I would disagree, is a template, because that would allow for
unlimited complexity of what is defined, in particular multiple tasks.
Here, we are just presetting arguments of a call, which is exactly
what a LISP (or other functionsl languages) closure does. But lets
not get into semantics here...

Actually, I do not think it is that difficult, or requires too many changes.
What I was thinking was to represent the "template" as an UnknownElement
instance tree (the same way the parser does). The project will have a 
created an UnknownElement tree for the <mycommand> task.

Now the only thing needed, is to mix the two of them during the configure
process and there you have it, you are ready to proceed as ussual.

So to me, this may be even simpler than having <argsets>. As long as
UnknownElements are Cloneable, so you can create a DEEP copy of the 
"template", that is all you need.

I thought about doing it myself, but time is not there yet...

Jose Alberto

> Vincent.
> 
> ----- Original Message ----- 
> From: "Jose Alberto Fernandez" <JFernandez@viquity.com>
> To: <ant-dev@jakarta.apache.org>
> Sent: Friday, October 27, 2000 4:05 PM
> Subject: RE: Some Thoughts on Ant 1.3 and 2.0
> 
> > I really, think it would be more usefull we we could define new
> > tasks which just provide a predefined set of parameters for
> > normal tasks. A loose set of arguments as a datatype is a 
> very strange
> > concept that smells to me like a MACRO expansion.
> > 
> > I would prefer having something like closures:
> > 
> >  <taskdef name="mycommand" >
> >    <java classname="....." >
> >     <classpath refid="..." />
> >     <sysproperty key=".." value="..." />
> >     <arg value="..." />
> >    </java>
> >  </taskdef>
> > 
> > ....
> > 
> >  <target ... >
> >   <mycommand>
> >    <arg file="..." />
> >   </mycommand>
> >  </target>
> > 
> > Here the <mycommand> task is equivalent to:
> > 
> >    <java classname="....." >
> >     <classpath refid="..." />
> >     <sysproperty key=".." value="..." />
> >     <arg value="..." />
> >     <arg file="..." />
> >    </java> 
> > 
> > If I had this functionality, I could reduce my build files 
> for at least 50%
> > and they would be 10X more readable.
> > 
> > Jose Alberto
> > PS: This is not just for the <java> task, but for any other task.
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 

Mime
View raw message