iPhone Dev - Project.pbxproj有多重要?

时间:2023-01-16 15:30:13

What does this file hold and how important is it to keep it "correct"?

这个文件包含什么?保持它“正确”有多重要?

I've seen people write scripts to just merge any change dealing with it and I've heard others merging it manually every time.

我曾见过人们编写脚本来合并处理它的任何变更,我也听说过其他人每次都手工合并它。

What is the correct way to handle it and why?

正确的处理方法是什么?为什么?

2 个解决方案

#1


21  

The project.pbxproj contains all of the metadata about your project that Xcode uses to build it; the settings, the file references, configuration, targeted platforms, etc...

该项目。pbxproj包含Xcode用于构建项目的所有关于项目的元数据;设置、文件引用、配置、目标平台等……

I.e. it is a critically important.

也就是说,它非常重要。

There really isn't a great answer for this. Typically, teams will avoid conflict by limiting edits to the project to one team member at a time.

这并不是一个很好的答案。通常,团队将通过每次只对一个团队成员编辑项目来避免冲突。

The Xcode team has put a lot of effort into making the file merge-friendly. In managing several large projects via svn, I've generally found that the merges are automatic and painless.

Xcode团队在使文件易于合并方面做了大量工作。在通过svn管理几个大型项目时,我通常发现合并是自动的,没有痛苦。

Until they aren't. And when they aren't, revert, merge changes by hand (i.e. make the changes in the project that conflicted), and move on.

直到他们不是。当它们不存在时,恢复,手工合并变更(即在项目中做出冲突的变更),然后继续前进。

#2


3  

Try my script xUnique. What it does:

xUnique试我的脚本。它所做的:

  1. convert project.pbxproj to JSON format
  2. 转换项目。pbxproj JSON格式
  3. Iterate all objects in JSON and give every UUID an absolute path, and create a new UUID using MD5 hex digest of the path
    • All elements in this json object is actually connected as a tree
    • 这个json对象中的所有元素实际上都是以树的形式连接的
    • We give a path attribute to every node of the tree using its unique attribute; this path is the absolute path to the root node,
    • 我们使用树的唯一属性给树的每个节点一个路径属性;这条路径是到根节点的绝对路径,
    • Apply MD5 hex digest to the path for the node
    • 对节点的路径应用MD5十六进制摘要
  4. 遍历所有对象的JSON,给每一个UUID绝对路径,并创建一个新的UUID使用MD5十六进制消化路径的所有元素在这个JSON对象实际上是连接树我们给一个路径属性树的每个节点使用其独特的属性;该路径是到根节点的绝对路径,将MD5十六进制应用到节点的路径
  5. Replace all old UUIDs with the MD5 hex digest and also remove unused UUIDs that are not in the current node tree and UUIDs in wrong format
  6. 用MD5十六进制摘要替换所有旧的uuid,并以错误的格式删除不在当前节点树中的未使用的uuid和uuid
  7. Sort the project file inlcuding children, files, PBXFileReference and PBXBuildFile list and remove all duplicated entries in these lists
    • see sort_pbxproj method in xUnique.py if you want to know the implementation;
    • 参见xUnique中的sort_pbxproj方法。如果你想知道实现;
    • It's ported from my modified sort-Xcode-project-file, with some differences in ordering PBXFileReference and PBXBuildFile
    • 它是从我修改过的sort-Xcode-project-file中移植的,在订购PBXFileReference和PBXBuildFile方面有一些不同
  8. 对项目文件进行排序,包括子、文件、PBXFileReference和PBXBuildFile列表,并删除这些列表中的所有重复条目,参见xUnique的sort_pbxproj方法。如果你想知道实现;它是从我修改过的sort-Xcode-project-file中移植的,在订购PBXFileReference和PBXBuildFile方面有一些不同
  9. With different options, you can use xUnique with more flexibility
  10. 使用不同的选项,您可以使用xUnique,具有更大的灵活性

#1


21  

The project.pbxproj contains all of the metadata about your project that Xcode uses to build it; the settings, the file references, configuration, targeted platforms, etc...

该项目。pbxproj包含Xcode用于构建项目的所有关于项目的元数据;设置、文件引用、配置、目标平台等……

I.e. it is a critically important.

也就是说,它非常重要。

There really isn't a great answer for this. Typically, teams will avoid conflict by limiting edits to the project to one team member at a time.

这并不是一个很好的答案。通常,团队将通过每次只对一个团队成员编辑项目来避免冲突。

The Xcode team has put a lot of effort into making the file merge-friendly. In managing several large projects via svn, I've generally found that the merges are automatic and painless.

Xcode团队在使文件易于合并方面做了大量工作。在通过svn管理几个大型项目时,我通常发现合并是自动的,没有痛苦。

Until they aren't. And when they aren't, revert, merge changes by hand (i.e. make the changes in the project that conflicted), and move on.

直到他们不是。当它们不存在时,恢复,手工合并变更(即在项目中做出冲突的变更),然后继续前进。

#2


3  

Try my script xUnique. What it does:

xUnique试我的脚本。它所做的:

  1. convert project.pbxproj to JSON format
  2. 转换项目。pbxproj JSON格式
  3. Iterate all objects in JSON and give every UUID an absolute path, and create a new UUID using MD5 hex digest of the path
    • All elements in this json object is actually connected as a tree
    • 这个json对象中的所有元素实际上都是以树的形式连接的
    • We give a path attribute to every node of the tree using its unique attribute; this path is the absolute path to the root node,
    • 我们使用树的唯一属性给树的每个节点一个路径属性;这条路径是到根节点的绝对路径,
    • Apply MD5 hex digest to the path for the node
    • 对节点的路径应用MD5十六进制摘要
  4. 遍历所有对象的JSON,给每一个UUID绝对路径,并创建一个新的UUID使用MD5十六进制消化路径的所有元素在这个JSON对象实际上是连接树我们给一个路径属性树的每个节点使用其独特的属性;该路径是到根节点的绝对路径,将MD5十六进制应用到节点的路径
  5. Replace all old UUIDs with the MD5 hex digest and also remove unused UUIDs that are not in the current node tree and UUIDs in wrong format
  6. 用MD5十六进制摘要替换所有旧的uuid,并以错误的格式删除不在当前节点树中的未使用的uuid和uuid
  7. Sort the project file inlcuding children, files, PBXFileReference and PBXBuildFile list and remove all duplicated entries in these lists
    • see sort_pbxproj method in xUnique.py if you want to know the implementation;
    • 参见xUnique中的sort_pbxproj方法。如果你想知道实现;
    • It's ported from my modified sort-Xcode-project-file, with some differences in ordering PBXFileReference and PBXBuildFile
    • 它是从我修改过的sort-Xcode-project-file中移植的,在订购PBXFileReference和PBXBuildFile方面有一些不同
  8. 对项目文件进行排序,包括子、文件、PBXFileReference和PBXBuildFile列表,并删除这些列表中的所有重复条目,参见xUnique的sort_pbxproj方法。如果你想知道实现;它是从我修改过的sort-Xcode-project-file中移植的,在订购PBXFileReference和PBXBuildFile方面有一些不同
  9. With different options, you can use xUnique with more flexibility
  10. 使用不同的选项,您可以使用xUnique,具有更大的灵活性