How would you write a build.xml
file, using neither custom code nor external dependencies (such as a shell script), that:
- Generates a build number of the form major.minor.revision (e.g., 01.02.34).
- Auto-increments the revision on each compile of the source code.
- Auto-increments the minor version on each execution of a dist(ribution) task.
Additionally:
- Provides an option to increment the major number.
- Provides an option to increment the minor number.
- Whenever the major number is incremented, the minor and revision numbers are set to 0.
- Whenever the minor number is incremented, the revision number is set to 0.
Bonus:
- Creates a variable based on the
git
revision number (like a subversion revision number).
Clarification:
- Automatic checkout (or checkin) is not required.
- Integration with Subversion is not desired.
Thank you for any examples. Here are some related sites that perform similar tasks:
- Create a Build Number with Ant.
- Using the BuildNumber Ant task.
- Ant and Build Version Numbers.