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

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

问题描述

在合并分支(我使用git)时,Xcode项目文件(Project.xcodeproj / project.pbxproj)中经常存在冲突。有时候这很容易,但有时我最终会得到一个损坏的项目文件,并且必须恢复。在最糟糕的情况下,我必须通过拖拽文件等方式在第二次提交(可以用前一次提交)中手动修复项目文件。

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




编辑 - 一些相关问题:

Git和pbxproj



我应该使用merge = union来合并.pbxproj文件吗?



资源:



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



http://www2.informatik.hu-berlin.d e /〜obecker / XSLT /#合并

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/

解决方案


<2>设计容易重建 - 这也是如果您正在编写必须由多个工具或IDE构建的程序,这会有所帮助。我的许多'项目'可以通过添加一个目录来重建。



3)删除多余的构建阶段。例如:我已经从所有项目中删除了复制标题构建阶段。通过include指令明确包含特定文件。



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



<5>对于目标依赖关系:创建目标它们执行逻辑操作,而不是物理操作。这通常是一个shell脚本目标或聚合目标。例如:构建依赖关系,运行所有单元测试,全部构建,全部清理。那么你不必每一步都维护每一个依赖关系的变化 - 就像使用引用一样。

6)为你的代码定义一个通用的源代码树,并且第三方来源的第二个。

7)有可用的外部构建工具。这对你来说可能是一种选择(至少对于你的一些目标来说)。

在这一点上,xcodeproj将会简单得多。它将需要更少的更改,并且很容易重建。您可以进一步了解这些概念,以进一步降低项目和构建的复杂性。


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.

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


EDIT-- Some related questions:

Git and pbxproj

Should I merge .pbxproj files with git using merge=union?

RESOURCES:

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) 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.

2) 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.

3) 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.

4) 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.

5) 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.

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

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

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天全站免登陆