The "for" task in AntContrib accepts a "list" to iterate upon:
<for param="someParam" list="1,2,3,4,5"
However, if the number of times/elements to iterate is higher then it becomes difficult to specify those many elements in the list. For example if the task has to iterate for 300 times.
A better easier way would be to allow a "listStart" and "listEnd" attributes to the "for" task which will be the start index of the list and end index of the list (if the "list" itself is not specified). This way, to iterate around 300 times, we could have:
<for param="someParam" listStart="1" listEnd="300">
I have a patch which does this. Attached is the patch. Well not exactly a "patch" since i could not locate the SVN repo for this project, these are 2 java files which were changed. This now allows, the "for" task to have:
1) It allows a "listStart" and "listEnd" to be specified (as shown above).
2) Both attributes values are expected to be valid integers, if not, a build error message will be printed.
3) listEnd cannot be lesser than listStart. A build error message will be printed in such cases
4) listStart and listEnd will be ignored if "list" is specified
Log in to post a comment.