为了自动更新构建日期和构建编号,我在计划中设置了一个构建阶段的运行脚本:
# Auto Increment Version Script
buildPlist=${PROJECT_DIR}/${INFOPLIST_FILE}
CFBuildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBuildNumber" $buildPlist)
CFBuildNumber=$(($CFBuildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBuildNumber $CFBuildNumber" $buildPlist
# "Mon" is a hack, but day is needed, and in English
CFBuildDate=$(date "+Mon %b %d %H:%M:%S %Z %Y")
/usr/libexec/PlistBuddy -c "Set :CFBuildDate $CFBuildDate" $buildPlist
虽然这样做可行,但缺点是这些方案绑定到特定用户的设置上,即它们被排除在版本控制之外,并且很容易丢失。
如何正确解决此问题并使这些脚本对所有开发人员都可用?