在XCode编译上运行Bash脚本 - 在哪里获取构建变量列表? [英] Running Bash Script on XCode Compile -- Where To Get List of Build Variables?

查看:268
本文介绍了在XCode编译上运行Bash脚本 - 在哪里获取构建变量列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用XCode编译Cocoa应用程序时,我在构建阶段运行一个自定义的Bash脚本。不幸的是,我必须拼出完整的路径。相反,我几乎肯定有可以在Bash中使用的变量,其中一个可能会覆盖它。这是我正在运行的:

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

看看如何使用$ VAR来帮助,而不是指定物理路径?这也可以帮助我的团队的成员能够编译这个项目,而无需修改。



我尝试查看XCode7文档,但找不到任何列表这些变量可能是我可以使用的。



请注意,路径/ Users / mike / Projects / objectivec / proj1 / proj1 /文件夹包含我的AppDelegate.mm文件您可以告诉我可以在这个可用变量列表中找到文档,以便我不必指定完整的物理路径?

解决方案

这个修复是我让它运行这个Bash脚本作为测试:

 #!/ bin / bash 

set> /tmp/vars.txt

然后,我编译了一个构建。之后,我查看了/tmp/vars.txt来查看可用的内容。从那里,我可以直接在我的自定义Bash脚本和XCode中的黑色脚本字段中使用这些,例如 $ SOURCE_ROOT


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?

解决方案

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.

这篇关于在XCode编译上运行Bash脚本 - 在哪里获取构建变量列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆