- Published on
Xcode project build number use svn revision
- Authors
- Name
- Tong
I wrote a script auto read svn revision number and replace Xcode project build number.
Select the project under TARGETS then click the + on top-left conor
Choose New Run Script Phase
Copy and paste this script
The script is
REV_GIT=`git svn info |grep Revision: |cut -c11-`
REV_SVN=`svn info |grep Revision: |cut -c11-`
if [ -z $REV_GIT ] ;then
REV=$REV_SVN
else
REV=$REV_GIT
fi
echo "REV is $REV"
BASEVERNUM=`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "${INFOPLIST_FILE}"`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $REV" "${INFOPLIST_FILE}"
I have posted this script to GitHub Gist
Everytime when you build, project build number will auto update.
View on GitHub • This article is licensed under a CC BY-SA 4.0 license.