ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Castrianni <Shawn.Castria...@halliburton.com>
Subject RE: Looping number of times
Date Tue, 13 Apr 2010 19:54:32 GMT
That is why I said in my response:

"I either could not get the ones I found working, or they were just too complicated"

If you take the while task I sent source code for, and then combine that with antelope tasks
to do math operations, you can write a for loop on an index with:

<?xml version="1.0" encoding="UTF-8"?>
<project name="loop" xmlns:bt="antlib:mytasks" xmlns:at="antlib:ise.antelope.tasks">
	<target name="test">
		<property name="index" value="1"/>
		<bt:while property="index" unless="11">
			<sequential>
            <echo message="index: ${index}"/>
            <at:math result="index" operand1="${index}" operation="+" operand2="1" datatype="int"/>
			</sequential>
		</bt:while>
	</target>
</project>

Running this test, gives you:

test:
     [echo] index: 1
     [echo] index: 2
     [echo] index: 3
     [echo] index: 4
     [echo] index: 5
     [echo] index: 6
     [echo] index: 7
     [echo] index: 8
     [echo] index: 9
     [echo] index: 10

BUILD SUCCESSFUL
Total time: 0 seconds
---
Shawn Castrianni

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information
for the sole use of the intended recipient.  Any review, use, distribution, or disclosure
by others is strictly prohibited.  If you are not the intended recipient (or authorized to
receive information for the intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.

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


Mime
View raw message