views:

111

answers:

2

Apparently the file gets cached, so it only gets built when it gets changed. I have environment variables set to increment my version number though, and such, and update them independently of the plist (in the project build settings, actually). Is there a script that I can use as a script build phase that will force the Info.plist to update? Some other convenient way?

A: 

You could try using the touch command to update the timestamp, which I assume is what Xcode uses to determine whether it should be rebuilt, e.g.

$ touch Info.plist
bosmacs
I tried touching from inside Xcode, but it doesn't do anything. Actually making a change to the Info.plist was the only way to get it to update. I'll try from the command line though, and see if it works
TraxusIV
Ok, adding a Run Script build phase with just "touch Info.plist" causes it to auto update when I build, but ONLY every other build.
TraxusIV
Is the Run Script build step the first to execute?
bosmacs
I forgot to mention that you may want to try adding Info.plist to the Output Files list in your Run Script phase. If that doesn't work, a better way might be to add a 'Shell Script' target to your application (under New Target -> Mac OS X -> Other) that executes your Run Script phase and add that as a direct dependency of your main target, similar to here: http://stackoverflow.com/questions/976454/xcode-running-a-script-before-every-build-that-modifies-source-code-directly
bosmacs
+1  A: 

There is an option in the "Build" tab of the target's Get Info window, down in "Packaging" labeled "Preprocess Info.plist file" that you can check. I believe that will update the file every build.

ExitToShell
nope, no-go. It also caused an error, since I have a URL in my copyright string, and the c-preprocessor apparently didn't know what to do with the // in the http://.
TraxusIV