合并 Xcode 项目文件 [英] Merging Xcode project files

查看:26
本文介绍了合并 Xcode 项目文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

合并分支时Xcode项目文件(Project.xcodeproj/project.pbxproj)经常会发生冲突(我用的是git).有时这很容易,但有时我最终会得到一个损坏的项目文件并且不得不恢复.在最坏的情况下,我必须通过拖入文件等在第二次提交中手动修复项目文件(可以与前一次一起压缩).

There are often conflicts in the Xcode project file (Project.xcodeproj/project.pbxproj) when merging branches (I'm using git). Sometimes it's easy, but at times I end up with a corrupt project file and have to revert. In the worst case I have to fix up the project file manually in a second commit (which can be squashed with the previous) by dragging in files etc.

有没有人知道如何处理像 Xcode 项目文件这样的大而复杂的文件中的合并冲突?

Does anyone have tips for how to handle merge conflicts in big and complex files like the Xcode project file?

编辑--一些相关问题:

Git 和 pbxproj

我应该使用merge=将.pbxproj文件与git合并吗工会?

资源:

http://www.alphaworks.ibm.com/tech/xmldiffmerge

http://www2.informatik.hu-berlin.de/~obecker/XSLT/#merge

http://tdm.berlios.de/3dm/doc/thesis.pdf

http://www.cs.hut.fi/~ctl/3dm/

http://el4j.svn.sourceforge.net/viewvc/el4j/trunk/el4j/framework/modules/xml_merge/

推荐答案

  1. 将您的项目分解为更小、更具逻辑性的库/包.大型项目通常是糟糕设计的标志,例如做得太多或太大的对象.

  1. Break your projects up into smaller, more logical libraries/packages. Massive projects are regularly the sign of a bad design, like the object that does way too much or is way too large.

易于重建的设计——如果您正在编写必须由多种工具或 IDE 构建的程序,这也很有帮助.我的许多项目"可以通过添加一个目录来重建.

Design for easy rebuilding -- this also helps if you're writing programs which must be built by multiple tools or IDEs. Many of my 'projects' can be reconstructed by adding one directory.

删除无关的构建阶段.示例:我已从所有项目中删除了Copy Headers"构建阶段.通过 include 指令显式包含特定文件.

Remove extraneous build phases. Example: I've removed the "Copy Headers" build phase from all projects. Explicitly include the specific files via the include directive.

尽可能使用 xcconfig 文件.这也减少了更新构建时必须进行的更改数量.xcconfig 文件定义了一组构建设置,并支持 #include.当然,当您定义要使用的 xcconfig 时,您随后会从每个项目和目标中删除(大部分)用户定义的设置.

Use xcconfig files wherever possible. This also reduces the number of changes you must make when updating your builds. xcconfig files define a collection of build settings, and support #include. Of course, you then delete the (majority of) user defined settings from each project and target when you define the xcconfig to use.

对于目标依赖:创建执行逻辑操作而不是物理操作的目标.这通常是一个 shell 脚本目标或聚合目标.例如:构建依赖项"、运行所有单元测试"、全部构建"、全部清理".那么您不必在每一步都维护每个依赖项更改 - 就像使用引用一样.

For target dependencies: create targets which perform logical operations, rather than physical operations. This is usually a shell script target or aggregate target. For example: "build dependencies", "run all unit tests", "build all", "clean all". then you do not have to maintain every dependency change every step of a way - it's like using references.

为您的代码定义一个通用的源代码树",并为第三方源定义第二个.

Define a common "Source Tree" for your code, and a second for 3rd party sources.

有可用的外部构建工具.这可能是您的一个选择(至少,对于您的某些目标而言).

There are external build tools available. This may be an option for you (at least, for some of your targets).

此时,xcodeproj 会简单得多.它将需要更少的更改,并且非常容易重建.您可以通过这些概念走得更远,以进一步降低项目和构建的复杂性.

At this point, a xcodeproj will be much simpler. It will require fewer changes, and be very easy to reconstruct. You can go much further with these concepts to further reduce the complexity of your projects and builds.

这篇关于合并 Xcode 项目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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