Skip to content

Instantly share code, notes, and snippets.

@lanephillips
Last active August 29, 2015 13:57
Show Gist options
  • Save lanephillips/9787452 to your computer and use it in GitHub Desktop.
Save lanephillips/9787452 to your computer and use it in GitHub Desktop.
Xcode Run Script build phase to copy Subversion revision info into a string constant.
VERSION=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/MyProject/MyProject-Info.plist"`
BUILD=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/MyProject/MyProject-Info.plist"`
REV=`svnversion -n`
DATE=`date "+%Y-%m-%d %H:%M:%S %Z"`
VS="Version: $VERSION Build: $BUILD\nRevision: $REV\nDate: $DATE"
echo "// This file is generated at build time." > ${PROJECT_DIR}/Revision.h
echo "// Do not edit it or add it to version control." >> ${PROJECT_DIR}/Revision.h
echo "#define kSOSRevision @\"$VS\"" >> ${PROJECT_DIR}/Revision.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment