Skip to content

Instantly share code, notes, and snippets.

@jessedc
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessedc/43c081255d4b8ae4db8e to your computer and use it in GitHub Desktop.
Save jessedc/43c081255d4b8ae4db8e to your computer and use it in GitHub Desktop.
Setting CFBundleVersion to CFBundleShortVersionString plust the git rev list count
buildPlist=${TARGET_BUILD_DIR}/${INFOPLIST_PATH}
plist='/usr/libexec/PlistBuddy -c'
CFBundleShortVersionString=`$plist "Print CFBundleShortVersionString" $buildPlist`
gitRevListCount=`git rev-list HEAD --count`
CFBundleVersion="$CFBundleShortVersionString.$gitRevListCount"
CFBuildDate=$(date -u +"%a %b %d %T GMT %Y")
$plist "Set :CFBundleVersion $CFBundleVersion" "$buildPlist"
$plist "Set :CFBuildDate $CFBuildDate" "$buildPlist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment