Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 build setting variables for scheme scripts

Tags:

xcode

iphone

I'm still getting used to Xcode 4, so forgive me if this is an asinine question:

In previous versions of Xcode, one could use any of the build setting variables (such as SRCROOT or PRODUCT_NAME, etc in any shell scripts associated with a build. This was easily accomplished by adding a 'Run Script' build phase to any target.

In Xcode 4, however, the addition of schemes (really great, by the way) seems to disallow the usage of any of these variables. Is it possible this is by design? Is there a workaround?

like image 361
beinstein Avatar asked Feb 02 '23 20:02

beinstein


1 Answers

In the "Run Script" scheme action in Xcode 4.2 there is a "Provide build settings from..." drop down menu where you can select a target from which you would like to have the environment variables from. See screenshot below:

"Provide build settings from" drop down menu

Apart from that, if you select "None", there will be a bunch of environment variables set by Xcode. You can discover all of them by doing something like printenv > ~/Desktop/printenv.txt to have them dumped to a text file.

Some of the more useful environment variables include ARCHIVE_PATH, SCHEME_NAME, USER, ARCHIVE_DSYMS_PATH, ARCHIVE_PRODUCTS_PATH.

like image 70
Martijn Thé Avatar answered Feb 13 '23 07:02

Martijn Thé