Buildnumber Task

An interesting (new to me) ant task is <buildnumber/>

Now that I own the “Pragmatic Project Automation” book I have started to streamline and automate my build process to finally bring everything under control.

While surfing the ant documentation for new tasks I stumbled upon the BuildNumber task. What it does is really simple. It simply keeps a count of how often it was called.

This is a basic task that can be used to track build numbers.

It will first attempt to read a build number from a file (by default, build.number in the current directory), then set the property build.number to the value that was read in (or to 0, if no such value). It will then increment the number by one and write it back out to the file. (See the Property File task if you need finer control over things such as the property name or the number format.)

While preparing the project for a new release (yeah I am working with head and release branches now, I am trying not to repeat error-prone behavior of the past), I got the build.number up to 180 on that branch. I am using the task in my ‘prepare’ target which is run everytime I call ant

My first release-release is online and …. of course right after deploying it, I had to fix a minor bug. But it is only one bugfix this time, and a small one and I was in control of the code 95% of the time. Which is a much better ratio then my normal ‘code swimming for the olympics’ type of bug-fixing 😉

By Yashima

Writer of code and stories