I want to use the SVN revision number as the 4th digit in my version number. In Visual Build, my version number is defined as
%MAJOR%.%MINOR%.%BUILD%.%REVISION%
and I'd like to populate the %REVISION% variable from SVN.
How can I achieve that in Visual Build?
Option 1: parse the XML
It's possible to implement that as a reusable subroutine step:
Update the repository if needed.
Use a "Subversion" action with the following settings:
Store the SVN information into a XML file
Use a "Run Program" action with the following settings:
Extract the revision
Use a "Run Script" action for VBScript and apply the following code:
Delete the temporary XML file
Use a "Delete Files" action with the setting
The subroutine should now look like this:
In order to use it from your build script, use the "Subroutine call" action and add OUTPUTMACRO with value REVISION. It should look like this:
Option 2: parse the command line output
Get the information about the repository
Use a "Subversion" action with the following settings:
In the script editor for the step, add the following code:
Save the temporary macro
Use a "Set macro" action with the following settings: