How about this: Create a "procedure" with the common tasks and use a
property as a "parameter"

<target name="update-com-components">
   <property name="COMDLL" value="kcsStream.dll">
   <call target="update-com-component">

   <property name="COMDLL" value="kcsStream2.dll">
   <call target="update-com-component">

   <property name="COMDLL" value="kcsStream3.dll">
   <call target="update-com-component">
</target>

<target name="update-com-component">
    <exec program="regsvr32" workingdir="C:\Windows\System32\" 
commandline="/s /u ${COMDLL}" failonerror="false" />
    <vssget
      dbpath="\\someserver\data\dev\software\source\vss\srcsafe.ini"
      username="${sourcesafe.username}"
      password="${sourcesafe.password}"
      path="$/VCpp/DLL/kcsStream/Bin/${COMDLL}"
      localpath="C:\Windows\System32"
      replace="true"
    />
    <exec program="regsvr32" workingdir="C:\Windows\System32\" 
commandline="/s ${COMDLL}" /> 
</target>



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Markus Ewald
Sent: Thursday, February 02, 2006 9:56 AM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] How to avoid repeating commands?

My NAnt .build files often have blocks like this in them (this one 
checks out a file from a sourcesafe repository):

    <exec program="regsvr32" workingdir="C:\Windows\System32\" 
commandline="/s /u kcsStream.dll" failonerror="false" />
    <vssget
      dbpath="\\someserver\data\dev\software\source\vss\srcsafe.ini"
      username="${sourcesafe.username}"
      password="${sourcesafe.password}"
      path="$/VCpp/DLL/kcsStream/Bin/kcsStream.dll"
      localpath="C:\Windows\System32"
      replace="true"
    />
    <exec program="regsvr32" workingdir="C:\Windows\System32\" 
commandline="/s kcsStream.dll" />

The bad thing is that there are about 10 files like this that need to be 
unregistered, updated and re-registered. I currently don't know of a 
better way than to repeat that block 10 times all over.

What I'd like to have is a list of the repository paths of all those 
DLLs and just let the above block run on each entry of the list once. 
I've taken a thorough look at <FileSet /> and <Path /> but I don't see 
any way to use them for that purpose. Isn't there something like a <for 
/> tag or so that I can use to iterate over some kind of list?

Thanks,
-Markus-


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to