1. Create a file say build.number (or change the name to one which gives you pride)
2. Add the following target to your build.xml file, change entry key to whatever you want the property name to be:
3. Make sure this target is executed on successful build for example after 'test' target, Once this target is executed you can use property build.number where-ever you like in build.xml, For example,<target name="increment_teh_build_number">
<propertyfile file="build.number"
comment="Build Number for ANT. Edit not!">
<entry key="build.number" type="int"
operation="+"
default="1" />
</propertyfile>
</target>
<property name="app.version" value="${major.minor}.${build.number}" />
Hope that saves you some.
4 comments:
I generally just use the svn version number for numbering builds.
If you look at http://swtbot.svn.sourceforge.net/svnroot/swtbot/trunk/net.sf.swtbot.build/build.xml, and a few properties below the beanshell, you'll see that I just pull out the svn revision number and use that to number a particular build.
That's good tip too. Although I can't use it out of the box though, I have to use CVS.
Thanks for the post. I guess you need to add
property file="build.number.properties"
before start using ${build.number}
Post a Comment