ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Fetzer <elstonk...@yahoo.com>
Subject Re: Reset BuildNumber
Date Mon, 04 May 2009 17:36:55 GMT
Thanks Francis, this cleaned it up A LOT!




________________________________
From: Francis Galiegue <fge@one2team.com>
To: Ant Users List <user@ant.apache.org>
Sent: Saturday, May 2, 2009 2:50:06 AM
Subject: Re: Reset BuildNumber

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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message