ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <flo...@mindspring.com>
Subject Re: Invoking a target (Ant 1.7) in a loop (Ant-Contrib)
Date Tue, 16 Jan 2007 20:14:54 GMT
Just curious, but why not make computeCheckSum a macrodef instead of a 
target?  Does it ever "stand on its own" or is it sorta a functional 
unit to be called?  By that, I mean do you ever execute ant using that 
as a target or is it a utility type thing?

Rebo, Alex wrote:
> Hello!
>  
> In attempt to compute checksums for all files in a directory I wrote this:
>  
> <fileset id="myLibs" dir="${extention}">
>     <include name="*.jar"/>
> </fileset>
>  
> .....
>  
> <target name="thisTargetName">
>     <foreach target="computeCheckSum" param="fileToWorkOn"
> inheritall="true"> 
>         <path> 
>             <fileset refid="myLibs" />
>         </path> 
>     </foreach>
> </target>
>  
> ....
>  
> <target name="computeCheckSum">
>     <checksum file="${fileToWorkOn}" algorithm="MD5" />
>     <echo>
>         Created checksum file for ${fileToWorkOn}.
>     </echo> 
> </target>
>  
> OK. It's, probably, the worst Ant you ever seen. (BTW, any comments on how
> to improve it
> are welcome). But it works ... until you ask it to become verbose.
>  
> Here what it does: 
>  
>   [antcall] calling target(s) [computeCheckSum] in build file
> C:\Devel\RAD\RADWor
> kspace_Sample\ConfigureServer\build.xml
> parsing buildfile C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer\build.xml
> wit
> h URI = file:/C:/Devel/RAD/RADWorkspace_Sample/ConfigureServer/build.xml
> Project base dir set to: C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer
> parsing buildfile
> jar:file:/C:/Java/Apache/Ant/ant-contrib/ant-contrib-1.0b3.jar
> !/net/sf/antcontrib/antlib.xml with URI =
> jar:file:/C:/Java/Apache/Ant/ant-contr
> ib/ant-contrib-1.0b3.jar!/net/sf/antcontrib/antlib.xml
> Trying to override old definition of task propertycopy
> Trying to override old definition of task shellscript
>  
> .....
>
> Trying to override old definition of task headMethod
> Trying to override old definition of task importurl
>  [property] Loading Environment env.
>  [property] Loading
> C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer\build.prope
> rties
>   [antcall] Entering
> C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer\build.xml.
> ..
> Build sequence for target(s) `computeCheckSum is [computeCheckSum]
> Complete build sequence is [computeCheckSum, determineEnv, selfCheck,
> destCheck,
> copy, configure, test, main, , verifyCheckSum]
>  
> computeCheckSum:
>   [antcall] Exiting
> C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer\build.xml.
>   [antcall] calling target(s) [computeCheckSum] in build file
> C:\Devel\RAD\RADWor
> kspace_Sample\ConfigureServer\build.xml
> parsing buildfile C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer\build.xml
> wit
> h URI = file:/C:/Devel/RAD/RADWorkspace_Sample/ConfigureServer/build.xml
> Project base dir set to: C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer
> parsing buildfile
> jar:file:/C:/Java/Apache/Ant/ant-contrib/ant-contrib-1.0b3.jar
> !/net/sf/antcontrib/antlib.xml with URI =
> jar:file:/C:/Java/Apache/Ant/ant-contr
> ib/ant-contrib-1.0b3.jar!/net/sf/antcontrib/antlib.xml
> Trying to override old definition of task propertycopy
> Trying to override old definition of task shellscript
>
> ...
>  
> Trying to override old definition of task headMethod
> Trying to override old definition of task importurl
>  [property] Loading Environment env.
>  [property] Loading
> C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer\build.prope
> rties
>   [antcall] Entering
> C:\Devel\RAD\RADWorkspace_Sample\ConfigureServer\build.xml.
>  
> Looks like it's calling itself via [antcall]. Is suppose to do that when
> target is invoked in a loop?
> Or I'm doing smth awfully "smart"?
>
>  
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


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


Mime
View raw message