Re: Workaround for Xcode Not Noticing new Build Settings in Info.plist Preprocessing
Re: Workaround for Xcode Not Noticing new Build Settings in Info.plist Preprocessing
- Subject: Re: Workaround for Xcode Not Noticing new Build Settings in Info.plist Preprocessing
- From: Jerry Krinock <email@hidden>
- Date: Wed, 19 Jan 2011 11:46:22 -0800
Sorry, my previous post on this topic was a "Mission (Not) Accomplished".
Because Xcode does Info.plist preprocessing before running any of your custom build phases, the workaround that I posted in this thread on Jan 03 fails on the *first* build after changing CURRENT_PROJECT_VERSION or other macro. It works on the second and subsequent builds.
Since my product includes an Internet Plug-In which the main app asks for its version and reinstalls if too old, I need the version given in Info.plist to be 100% reliable. So I spent a few more hours reverse-engineering Info.plist preprocessing and came up with the following new shell script. The *how* and *why* are explained in the comments.
------------------------
# This is to work around a long-standing bug in Xcode (5624954, Duplicate/4505141), which is that Xcode does not check for changed Build Settings that are referenced in Info.plist when it decides whether or not to preprocess, recreate and produce a new Info.plist file. Therefore, for example, if you change your CURRENT_PROJECT_VERSION Build Setting and rebuild, the version number given in the Info.plist in the new product may still be the old version. This script forces Xcode to do Info.plist Preprocessing and produce new Info.plist file(s) with every build.
# Because Xcode does Info.plist preprocessing *before* running any of your custom build phases, you must add this as the shell script in a Shell Script Target (New Target ▸ Other ▸ Shell Script Target), and add said Shell Script Target as a dependency to any product Target which employs Info.plist preprocessing.
# In a multi-product project, I typically have several Info.plist sources, one for each product target which has an Info.plist. Each one has a prefix to indicate its target. Example: MainApp-Info.plist, MyFramework-Info.plist, HelperTool-Info.plist. They all reside in the project directory. The following file glob thus touches all of them:
infoPlistGlob="$PROJECT_DIR/*Info.plist"
touch $infoPlistGlob
echo Touched $infoPlistGlob
exit 0
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden