Ant: The Definitive Guide, 2nd Edition

3.7. Setting Build Numbers

Anyone who has released software commercially knows how important it is to keep track of build numbers. The first version of your software might be 1.0.0, an update might be 1.0.1, a major update might be 2.0.0, and so on. The buildnumber task is a basic task that can be used to track these kinds of build numbers.

This task will first attempt to read a build number from a file (by default, build.number in the current directory) and set the property build.number to the value that was read in (or to 0, if no value was read). It will increment the number by one and write the new value back to the file.

This task has only one attribute, file, which holds the name in which you want to store the build number. This attribute is not required. I'll take a look at an example using buildnumber after discussing time stamps, the next topic.

    Категории