Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone Dev - How important is Project.pbxproj?

Tags:

git

xcode

iphone

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?

like image 935
RyanJM Avatar asked May 09 '11 02:05

RyanJM


People also ask

Should I ignore project Pbxproj?

This file holds the list of all the files in the project, settings of targets and which files belong to which targets. It's probably the meatiest file in project bundle. You should not ignore this file.

What is project Pbxproj file?

Data file created by Xcode, a development application for Mac OS X; saves project data such as the list of source code and resource files and the build properties; also saves the Group data, which organizes the resource files in a virtual folder hierarchy.

What is Pbxproj in Xcode?

pbxproj contains all of the metadata about your project that Xcode uses to build it; the settings, the file references, configuration, targeted platforms, etc... I.e. it is a critically important.


2 Answers

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

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.

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.

like image 160
bbum Avatar answered Oct 13 '22 00:10

bbum


Try my script xUnique. What it does:

  1. convert project.pbxproj to JSON format
  2. 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
    • 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
  3. 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
  4. 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;
    • It's ported from my modified sort-Xcode-project-file, with some differences in ordering PBXFileReference and PBXBuildFile
  5. With different options, you can use xUnique with more flexibility
like image 22
Xiao Avatar answered Oct 13 '22 01:10

Xiao