ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebo, Alex" <Alex.R...@acs-inc.com>
Subject Invoking a target (Ant 1.7) in a loop (Ant-Contrib)
Date Tue, 16 Jan 2007 19:47:00 GMT
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"?

 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message