Created
April 16, 2013 05:16
-
-
Save tokorom/5393547 to your computer and use it in GitHub Desktop.
AdHocビルドのときだけバージョン文字列に最終コミットの時間を追記するスクリプト。
DebugビルドやDistributionビルドのときは発動しない。
Configuration名のはじめに `ADHOC` があるかどうかで発動が決まるので、`AdHoc`といったConfiguration名にしておく必要がある。
This file contains hidden or 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
configuration=`echo ${CONFIGURATION} | tr a-z A-Z` | |
if expr ${configuration} : "^ADHOC" > /dev/null; then | |
# AdHoc | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${PROJECT_NAME}/App-Info.plist") | |
date=`git log -1 --format='%ci'` | |
buildNumber="${buildNumber} (${date})" | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${PROJECT_NAME}/App-Info.plist" | |
else | |
# Debug or Distribution | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${PROJECT_NAME}/App-Info.plist") | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${PROJECT_NAME}/App-Info.plist" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build Phase
のCompile Sources
よりも前にこのRun Scriptを挿入しておく。