Hello!
I would like to insert the current Subversion revision number (as reported by svnversion
) into my Xcode project. I managed to insert the revision number into the Info.plist
in the $PROJECT_DIR
, but this is not a good solution, since the file is versioned. I tried to insert the revision into the Info.plist
in the build directory, but then I get an error during the code signing phase (this is an iPhone application).
Is there a simple way to get the revision number into the application using some build files, so that the changing revision does not change versioned files? I thought maybe I could create a temporary source file that would link with the others and provide a function to get the revision number. But I don’t know how to do that.
I am not much interested in other solutions, ie. the agvtool
. All I want is the revision number available to the application, without too much magic.
Update: Now this was easy. Thanks, svinto, this did not occur to me. All you have to do is create a new Run Script phase that does something like this:
REV=`svnversion -n`
echo "#define kRevisionNumber @\"$REV\"" > ${PROJECT_DIR}/revision.h
Then add the revision.h
to the project, include wherever you like and tell Subversion to ignore it.