Example using build number in version string when building Android project via ant?
We are using Hudson to automate our Android build. I need to incorporate the build number into the version string used in our app. Was wonderi开发者_StackOverflow社区ng if anyone had an example of doing that before I (re?)invent that wheel. Obviously I need to replace a string value in one of our config files.
Your shell script has access to the environment variable "BUILD_NUMBER", for example "153". You could use that in your config file.
You could also consider "BUILD_ID ", which adds time/date info, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)
To be super-verbose, you could use the "BUILD_TAG" variable, which is a string of "hudson-${JOBNAME}-${BUILD_NUMBER}"
Finally, there is a version number plugin:
http://wiki.hudson-ci.org/display/HUDSON/Version+Number+Plugin
... which gives you a ton of other options.
精彩评论