agvtool

Posted in |

agvtool can be used to bump the versioning info for your app. In particular it can increment CFBundleVersion entries in info.plist files as well as generating C versioning symbols. This can be especially useful if you have a lot of targets in your build as agvtool can increment the bundle version for all of them.

The agvtool executable can be found in /Developer/usr/bin but there is a bash wrapper script in /usr/bin.

Chris Hanson's blog post has lots of relevant info.

To use it just run the command in the project folder:

agvtool next-version -all


The -all option ensures that all targets are updated.

Useful as as agvtool is it doesn't seem to deal with cases where you have attached an info.plist to a foundation executable with a linker flag such as:

-sectcreate __TEXT __info_plist "MyApp-info.plist"


You can set the Xcode build setting INFOPLIST_FILE for your foundation target and agvtool will report it as updated but in my case the plist remained unaltered.

An alternative to trying to pull your version info from the Info.plist is to use the C symbols generated by Xcode when using Apple generic versioning. Xcode will auto generate the specified versioning file but will not add it to the project as a visible source file. The generated file is a derived source and can be found in the project build folder at:

<app-name>.build/<build config>/<target>.build/DerivedSources

In order to use the auto generated version strings just declare them as externs:

extern double MyAppVersionNumber;
extern const unsigned char MyAppVersionString[];

The ability to set the generated versioning file name seems to serve little purpose, except perhaps to permit the creation of a similarly named header containing the extern decs.

Submitted by Jonathan Mitchell on Tue, 08/18/2009 - 14:59

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
Let us know you are human.
8 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.