You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Matthew Hughes <mh...@feith.com> on 2006/02/14 20:07:23 UTC
How to update build number without screwing up build.properties format
I have a build.properties file that contains my build.number property.
Part of my build is updating that number by one on each build using:
<propertyfile file="build.properties" >
<entry default="0001" key="build.number" operation="+" pattern="0000"
type="int" />
</propertyfile>
It does what it needs to do, but it also reorders all the other
properties in the file. I have a lot of properties in the file and
group them with carriage returns to make it easier to see what does
what. Any suggestions for how to update the number without scrambling
the order of properties.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: How to update build number without screwing up build.properties format
Posted by Ninju Bohra <ni...@yahoo.com>.
How about
1) Read the properties in (via <loadproperties>)
2) Generate a property whose value equals the line of text in question (i.e. the value might be 'build.number=100')
3) Using the <math> element (from ant-contrib) to generate the next number into a property
4) Assign a property whose value equals the new line you want (i.e. the value might be 'build.number=101')
5) Use the <replace> task to replace the string in the file that matches the value from step (2) with the string from step (4)
Alternatively use a front-end build number controller (like CruiseControl) to provide you a forward marching build number
Later,
Ninju
----- Original Message ----
From: Matthew Hughes <mh...@feith.com>
To: user@ant.apache.org
Sent: Tuesday, February 14, 2006 1:07:23 PM
Subject: How to update build number without screwing up build.properties format
I have a build.properties file that contains my build.number property.
Part of my build is updating that number by one on each build using:
<propertyfile file="build.properties" >
<entry default="0001" key="build.number" operation="+" pattern="0000"
type="int" />
</propertyfile>
It does what it needs to do, but it also reorders all the other
properties in the file. I have a lot of properties in the file and
group them with carriage returns to make it easier to see what does
what. Any suggestions for how to update the number without scrambling
the order of properties.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org