101010
101010

Reputation: 15736

How do I make Xcode 4 run my Pre-Actions?

I can't seem to get Xcode 4 to reliably execute my pre-actions. I've tried cleaning and rebuilding. It doesn't seem to do it consistently. Is it even trying? I can't tell. I've put some echos in it (it's a bash script) and nothing is happening. This all worked in Xcode 3.

Upvotes: 4

Views: 6973

Answers (3)

webmat
webmat

Reputation: 60606

Note that your pre-build actions are not executed in your project's source directory. They are executed somewhere in Library/Developer/XCode/DerivedData/.

If you want to play with files in your project's source directory before compilation, you need to prepend it with ${PROJECT_DIR}/.

Upvotes: 17

Brad G
Brad G

Reputation: 2593

You need to add a "Run Script" to your build phases, and then drag it's position above the compile sources build phase.

I don't understand the purpose of a "pre-action" yet, doesn't seem to even get executed. However in my case I just needed a script to execute before my sources were compiled.

Upvotes: 5

Dru Freeman
Dru Freeman

Reputation: 1826

Remember that pre-actions do not pick up env variables. They are primarily meant to load or notify that the build is starting. If it worked in Xcode 3, you may want to use it more as a build script than a pre-action.

Upvotes: 1

Related Questions