Skip to content

Instantly share code, notes, and snippets.

@rsobik
Last active October 12, 2015 16:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsobik/4054574 to your computer and use it in GitHub Desktop.
Save rsobik/4054574 to your computer and use it in GitHub Desktop.
Update CFBundleVersion
# Update the CFBundleVersion in the generated Info.plist using the count of all commits
# Use Xcode's copy of the Git binary
GIT=`xcrun -find git`
# Use the commit count as CFBundleVersion
GIT_COMMIT_COUNT=`${GIT} rev-list --all | wc -l | tr -d ' '`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${GIT_COMMIT_COUNT}" "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${GIT_COMMIT_COUNT}" "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist"
@rsobik
Copy link
Author

rsobik commented Nov 11, 2012

Append a "Run Script" build phase to the application's target. The script shall contain the shell script shown above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment