ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Invoking a target (Ant 1.7) in a loop (Ant-Contrib)
Date Wed, 17 Jan 2007 11:02:24 GMT
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>


I want to ask an even sillier question. why not just hand the entire 
fileset to <checksum>?

<checksum algorithm="MD5" >
	<fileset refid="myLibs" />
</checksum>

No macros, no iteration; ant does the bulk work with depdnency logic. 
See example 7 and 8 in the checksum page in teh manual.

Remember: most Ant tasks are designed to work in bulk, with filesets or 
paths as params. In Ant 1.7, many support resources, which provides you 
even more ways to source data.

-Steve


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


Mime
View raw message