如何使X code运行依赖之前的脚本? [英] how to make xcode run a script before dependencies?

查看:128
本文介绍了如何使X code运行依赖之前的脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情景:

TargetA ,这是一款iOS应用程序。这个程序使用一个静态库,由 TargetB 编译。
显然, TargetB TargetA 的依赖,而 TargetB TargetA 之前始终建立。到目前为止好。

I have TargetA, which is an iOS application. This app uses a static library, compiled by TargetB. Obviously, TargetB is a dependency of TargetA, and TargetB is always built before TargetA. So far so good.

现在,我想一个脚本来运行 TargetA 建成,但甚至在 TargetB

Now, I want a script to run TargetA is built, but even before TargetB.


  1. 添加一个设置汇总/外部构建目标,并使其 TargetA 的依赖。它一半的工作原理:X code运行设置 TargetB 在同一时间,所以 TargetB 可能会过早地建造。还不够好。

  2. 相同,但该计划没有建立在并行指定。这工作,但它是一个浪费,因为有一些其他目标可以建在并行。

  3. 运行在 pre-动作脚本建设方案里面的一步。这工作,但似乎是错误的(为什么从步输出不会进入构建日志;?所以也许我不打算使用这种方式)。

  1. Adding a "setup" aggregate/external-build target, and making it a dependency of TargetA. It half works: Xcode runs setup and TargetB at the same time, so TargetB may get built too soon. Not good enough.
  2. The same, but specifying in the scheme not to build in parallel. This works, but is a waste, since there are other targets that can be built in parallel.
  3. Run the script in a pre-action build step inside the scheme. This works, but seems wrong (why? output from that step doesn't go into the build log; so perhaps I'm not meant to use it this way?).

添加脚本 TargetB 的依赖。这将工作;然而, TargetB 实际上来自另一个子项目,并在建设中,但参数传递给脚本的上下文中还不知道(主要是根目录 TargetA 的项目)。

What I don't want to do:

Add the script as a dependency of TargetB. This would work; however, TargetB actually comes from another sub-project, and in the context of building it, parameters to the script are not yet known (mainly the root directory of TargetA's project).

我缺少什么,或者我不得不满足于#2或以上#3?

Am I missing anything, or do I have to settle for #2 or #3 above?

编辑:在上面的选项#2,改变依赖的顺序(在我的情况,设置之间 TargetB 于事无补 - X code仍然选择的顺序任意

in option #2 above, changing the order of dependencies (in my case, between Setup and TargetB does not help -- Xcode still selects the order arbitrarily.

推荐答案

运行脚本作为 pre-行动建设方案内一步是最好的方法完成你想要的。这种方法的一个常见的​​用途是调整项目的内部版本号基础上的源代码控制状态(的例如)。至于捕获脚本输出,不幸的是你能做的唯一的事情就是<一个href=\"http://stackoverflow.com/questions/10723174/where-is-the-logfile-located-for-x$c$c-scheme-post-actions\">redirect标准输出为脚本到一个日志文件。该日志文件可能是你的项目的一部分,所以它很容易从X code至查看。

Running the script as a pre-action build step inside the scheme is the best way to accomplish what you want. A common use of this approach is to adjust the project's build number base on the source control state (example). As far as capturing the script output, unfortunately the only thing you can do is redirect stdout for the script to a log file. That log file could be part of your project, so it would be easy to view from Xcode.

这篇关于如何使X code运行依赖之前的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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