ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis Galiegue <...@one2team.com>
Subject Re: Reset BuildNumber
Date Sat, 02 May 2009 08:50:06 GMT
Le Friday 01 May 2009 19:46:14 Eric Fetzer, vous avez écrit :
> So to make it work, here's what I had to do.  Seems like an awful lot of
> work to accomplish something simple like this.
>
[...]

You seem to be using ant-contrib, why not go with <var> and <math>?

<target name="main">
	<property file="build.number"/>
	<var name="next.major" value="${major.number}"/>
	<var name="next.minor" value="${minor.number"/>
	<if>
		<equals arg1="${major.increment}" arg2="true"/>
		<then>
			<math result="next.major" operand1="${next.major"}
				operation="+" operand2="1" datatype="int"/>
		</then>
		<else>
			<math result="next.minor" operand1="${next.minor"}
				operation="+" operand2="1" datatype="int"/>
		</else>
	</if>
	<propertyfile file="build.number">
		<entry key="major.number" value="${next.major}"/>
		<entry key="minor.number" value="${next.minor}"/>
	</propertyfile>
	<property name="full.buildnumber" value="${next.major}.${next.minor}"/>
	<echo message="Full version number is ${full.buildnumber}"/>
</target>

This example is based ona build.number file that contains both the 
major.number and minor.number, but you get the idea.

-- 
Francis Galiegue
fge@one2team.com
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
One2team
40 avenue Raymond Poincaré
75116 Paris

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


Mime
View raw message