ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril BERION <cber...@free.fr>
Subject Re: How to make generic rules
Date Mon, 04 Aug 2003 18:19:13 GMT
On Sun, 3 Aug 2003 23:18:02 -0700
"Harkness, David" <DHarkness@sonypictures.com> wrote:

> Also, from the original poster's question, it seems more that they
> wanted to set default attributes for tasks. For example:
> 
>   <default task="copy" attribute="overwrite" value="true"/>
>   <default task="jar" attribute="compress" value="true"/>
> 
> These would make it such that *not* specifying "overwrite" for <copy>
> would overwrite the files, and *not* specifying "compress" for <jar>
> would compress the JAR. I don't believe there is any way to change the
> default attribute settings for tasks, but that would be kinda cool.
> 

This is exactly what i want to do, set the default attribute one time and do not rewrite it
for each task call.
My goal is to reduce the size of my build file which becomes quite enormous. And to simplify
the usage of current task like jar by only specifying task specific attribute and not attribute
common for all task of the same type.

But it seems not to be possible with ant. 

Ant has a few step to do before being as powerful as make ;-)

Anyway thx for the information.


> Of course, you can do the same by setting a property
> 
>   <property name="default.jar.compress" value="true"/>
> 
> and then specifying that property in every <jar> task, but I think
> that's what the poster was trying to avoid in the first place. At least
> this buys you the ability to change the behavior build-wide by changing
> one property rather than every <jar> task.
> 
> David Harkness
> Sony Pictures Digital Networks
> (310) 482-4756
> 
> 
> -----Original Message-----
> From: Drew Davidson [mailto:drew@ognl.org] 
> Sent: Sunday, August 03, 2003 11:14 PM
> To: Ant Users List
> Subject: Re: How to make generic rules
> 
> 
> North Alex wrote:
> 
> >>I'm an old makefile user. Now i'm an ant user.
> >>But i haven't yet found a way to replace a powerfull
> >>functionality of make: implicit rules and import of rule from 
> >>a makefile in another makefile (include). In fact i need to 
> >>overide some task in order to define implicit properties.
> >>
> >>For example i want to set the compress attribute of jar task
> >>to false one time for the full build file and not to set it 
> >>for each jar task.
> >>
> >>How can i do this?
> >>    
> >>
> >
> >One way could be to set a property and use "unless" for a target that 
> >sets the properties you want.
> >
> >You can also call <ant> and set properties for that ant call ... or use
> 
> ><antcall> :
> >
> >	<antcall target="update.changehistory">
> >		<param name="history.version"
> >value="${component.version}"/>
> >	</antcall>
> >
> >	<antcall target="update.changehistory">
> >		<param name="history.version"
> >value="${baseline.version}"/>
> >	</antcall>
> >
> >So, update.changehistory can be called from different places with 
> >different values for the history.version
> >  
> >
> But bear in mind that <ant> and <antcall> reparses the entire ant file 
> each time they are used, so don't be lulled into thinking that they are 
> cheap function calls.
> 
> - Drew
> 
> -- 
> +---------------------------------+
> < Drew Davidson | OGNL Technology >
> <     Professional Open Source    >
> +---------------------------------+
> |  Email: drew@ognl.org          /
> |    Web: http://www.ognl.org   /
> |    Vox: (520) 531-1966       <
> |    Fax: (520) 531-1965        \
> | Mobile: (520) 405-2967         \
> +---------------------------------+
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message