How to Run a Custom Shell Script During an XCODE Build

Right click on the specific target in XCODE

201101231256.jpg

You can enter your shell script like this, here is a sample script to list available variables.

201101231258.jpg

Build and Run and come open build results to see your script results.

201101231259.jpg



Xcode 4 build setting variables for scheme scripts

转自:http://stackoverflow.com/questions/5319989/xcode-4-build-setting-variables-for-scheme-scripts

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_PATHSCHEME_NAMEUSER,ARCHIVE_DSYMS_PATHARCHIVE_PRODUCTS_PATH.



参考说明

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcrun.1.html

shell的官方参考网页

https://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004268-TP40003516


猜你喜欢

转载自blog.csdn.net/chun799/article/details/49804683