自动化在X code构建设置 [英] Automate the XCode build settings

查看:165
本文介绍了自动化在X code构建设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发我会如X code项目之间共享一个静态库。我做了一些阅读以了解究竟如何,以便它运行在设备和仿真并导致一对夫妇的手动步骤,我现在想自动上都包含这个库作为二进制依赖。总的来说,我希望能够释放我的图书馆的新版本,有一个简单的升级过程使用旧版本的任何项目。目前,该过程包括删除和/或复制新的二进制文件在原来的位置,删除复制在新的头文件。初始安装由带有额外的项目/目标级别配置沿着相同的两个步骤设置基于目标SDK有条件的链接标志。是否有这可能是自动的方法吗?我的意思是我知道我可以做这样的事情写一个AppleScript做繁重但如何?有没有人通过不断的AppleScript自动X code构建设置?我将如何通过AppleScript的调入X code吗?是否还有其他选择吗?有没有更好的办法来维持二进制级别的依赖关系?

I've developed a static library that I'd like to share between XCode projects. I did some reading to learn exactly how to include this library as a binary dependency so that it runs on both the device and the simulator and that lead to a couple of manual steps which I'd now like to automate. Overall I'd like to be able to release new versions of my library and have a simple upgrade process for any project using the older version. Currently that process consists of deleting and/or copying the new binary files over the original location, deleting copying over new header files. The initial install consists of the same two steps along with additional project/target level configuration to set conditional linker flags based on the target SDK. Is there a way this could be automated? I mean I know I could do something like write an Applescript to do the heavy lifting but how? Has anyone ever automated xcode build settings via applescript? How would I call into XCode via Applescript? Are there any other alternatives? Is there a better way to maintain binary level dependencies?

更新

我期待保持的二进制级别的相关性,其中A计划取决于类似于一个框架项目B.东西创造了一个静态库,可以被纳入一个X code iPhone轻松投影。建设B后,我想要的东西,虽然我意识到周围利用这样一个依赖我寻找一些解决方案软化了所有的粗糙边缘的所有程序,几乎可以被投进和项目,包括A.。

I'm looking to maintain a binary level dependency where project A depends on a static library created by project B. Something similar to a framework that can be included into an XCode iPhone project easily. After building "B" I want something that can practically be dropped into and project including A. While I am becoming aware of all the procedures around leveraging such a dependency I am looking for some solutions to soften up all of the rough edges.

推荐答案

X code 添加自定义生成脚本:

Add a custom build script through Xcode:


  • 选择左侧的目标组下你的目标

  • 选择添加 - >新建构建阶段 - >新运行脚本生成阶段

  • 在新的运行脚本项,双击你的目标下

  • 这允许你写一个shell脚本,访问大多数涉及到当前的构建,例如在X code的环境变量 $ BUILT_PRODUCTS_DIR

  • 如果您勾选显示环境,构建日志变量,并查看详细的生成输出你可以看到所有的变量可用。

  • select your target under the Targets group on the left
  • select Add -> New Build Phase -> New Run Script Build Phase
  • double click on the new Run Script item underneath your target
  • this allows you to write a shell script, accessing most of the Xcode environment variables related to the current build, e.g. $BUILT_PRODUCTS_DIR
  • if you check the "Show environment variables in build log" and view the detailed build output you can see all the variables available.

有一个谷歌搜索,你会发现很多的例子,例如第20.3条这里等。

Have a Google search and you'll find lots of examples, e.g. section 20.3 here etc.

如果你使用Subversion我相信你可以使用 SVN外部来指定要使用的库的特定版本。

If you are using Subversion I believe you can use SVN externals to specify which particular version of your library to use.

这篇关于自动化在X code构建设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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