Created
February 17, 2014 07:48
-
-
Save uasi/9046447 to your computer and use it in GitHub Desktop.
Xcode build phase that writes git revision to Info.plist in built product
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT_REVISION=$(git rev-parse --short HEAD 2> /dev/null) | |
if [ $? != 0 ]; then | |
GIT_REVISION="(not in git repo)" | |
elif [ -n "$(git status --porcelain)" ]; then | |
GIT_REVISION="${GIT_REVISION}+dirty" | |
fi | |
PLIST_PATH="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/Info.plist" | |
/usr/libexec/PlistBuddy -c "Set :GitRevision ${GIT_REVISION}" "${PLIST_PATH}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment