Skip to content

Instantly share code, notes, and snippets.

@huacnlee
Last active December 20, 2015 12:00
Show Gist options
  • Save huacnlee/6128098 to your computer and use it in GitHub Desktop.
Save huacnlee/6128098 to your computer and use it in GitHub Desktop.
Xcode 编译的时候自动修改 App 的 Build 为 Git 的 commit 次数,同时根据不同的 Build 模式,给 build 号加特别的后缀
GIT=/usr/bin/git
INFO_PLIST=$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Contents/Info.plist
BUILD_SUFIX=""
if [ $CONFIGURATION == Debug ]
then
BUILD_SUFIX="D"
fi
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion `$GIT rev-list HEAD --count`$BUILD_SUFIX" "$INFO_PLIST"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment