How to use For loop in CruiseControl.net

时间:2023-12-29 19:41:26

Looping through parameter values in Cruisecontrol.net

Example >>>>>>>>>>

  <cb:define name="ParentFolders">
<!--Define parent folders-->
['A', 'B', 'C']
</cb:define> <cb:define name="ChildFolders">
<!--Define child folders-->
['aa', 'ab', 'ba', 'bb', 'cc']
</cb:define> <!-- Loop through $(ParentFolders)\$(ChildFolders), do the task only if $(ParentFolders)\$(ChildFolders) exists.-->
<cb:for-each iterator-name="i" iterator-expr="$(ParentFolders)">
<cb:for-each iterator-name="j" iterator-expr="$(ChildFolders)">
<cb:scope ParentFolder="$(i)" ChildFolder="$(j)">
<conditional>
<conditions>
<folderExistsCondition>
<folder>$(ParentFolder)\$(ChildFolder)</folder>
</folderExistsCondition>
</conditions>
<tasks> <!-- Output folder name-->
<exec>
<executable>cmd.exe</executable>
<buildArgs>/c output.bat $(ParentFolder) $(ChildFolder)</buildArgs>
<baseDirectory>$(WorkDirectory)</baseDirectory>
</exec> </tasks>
</conditional>
</cb:scope>
</cb:for-each>
</cb:for-each>