Running Bash Script on XCode Compile — Where To Get List of Build Variables?

瘦欲@ 提交于 2019-12-12 17:03:46

问题


When using XCode to compile a Cocoa application, I'm running a custom Bash script in the build phase. Unfortunately, I'm having to spell out full paths. Instead, I'm almost certain there are variables I can use in the Bash and one of those might cover it. Here's what I'm running:

/Users/mike/Projects/objectivec/proj1/proj1/shellscript.sh  /Users/mike/Projects/objectivec/proj1/proj1/proj1/lang/en/html/

See how having a $VAR would help here, rather than specifying physical paths? It would also help members on my team be able to compile this project without modification.

I tried looking in the XCode7 docs, but couldn't find any listing anywhere of what these variables might be that I can use.

Note that the path /Users/mike/Projects/objectivec/proj1/proj1/ folder contains my AppDelegate.mm file in this case, if that helps you.

Can you tell me where I can find the documentation on this list of available variables so that I don't have to specify full physical paths?


回答1:


The fix was that I made it run this Bash script as a test:

#!/bin/bash

set > /tmp/vars.txt

Then, I compiled a build. After that, I looked in /tmp/vars.txt to see what was available to use. From there, I could use these directly both in my custom Bash script and in the black script field inside XCode, such as $SOURCE_ROOT.



来源:https://stackoverflow.com/questions/35098032/running-bash-script-on-xcode-compile-where-to-get-list-of-build-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!