Apologies for taking so long to respond to your question. It's been a long time since I made these changes so I'll try my best to explain it all π.
There is a good thread over here that gets into some more specifics but the issue with excluding the .xcodeproj/
in its entirety is that you are excluding files that shouldn't be excluded and may need to be shared across development team members. The additional rules I added address this problem of simply excluding the entire folder.
In order to address the additional rules I added in patch-1 I have included the follow tree
output of an Xcode
project; in particular, the .xcodeproj/
folder. I will use this to reference rules #2
, #3
and #4
below.
LicenseGenerator-iOS/LicensesViewController.xcodeproj/
βββ project.pbxproj
βββ project.xcworkspace
βΒ Β βββ contents.xcworkspacedata
βββ xcshareddata
βββ xcschemes
βββ LicensesViewController.xcscheme
In the above cited thread this comment discusses the efficacy of ignoring everything inside a *.xcodeproj
except the project.pbxpro
file itself.
A developer would want to include this file as it contains project data such as the list of source code and resource files along with build properties. It also saves group data which organises the files in the project (ref, ref).
While the up-votes and logic is sound, rules #3
and #4
also need consideration and shouldn't just be ignored as rules #1
and #2
would achieve doing this.
The /xcshareddata/
folder contains important xml
data contained within a *.xcscheme
file. In my example above the .xcscheme
file is called LicensesViewController.xcscheme
and this contains important information covering the:
- Build,
- Test,
- Launch,
- Profile,
- Analyse, and
- Archive configuration for the project.
View a gist file containing the source code of the LicensesViewController.xcscheme
file.
On this page it says:
The XCSCHEME file can be shared with other users or protected for a single user, which is useful for multi-developer projects.
While this is not conclusive enough to include the rule based on this, the page goes on to say that:
If the file is checked "Shared" in the "Manage Schemes" window, the file is stored in the
xcshareddata/xschemes
directory.
This is an important statement because a user in Xcode
has to check the option to share the scheme which in turn shows intent to want to share the file with other developers. If the file is excluded by rules #1
and #2
then the objective of sharing the scheme with others via SCM is lost.
The *.xcworkspace
folder (project.xcworkspace
in the example) contains the contents.xcworkspacedata
file which contains information describing the workspace or projects and lists the projects that are included as top-level entities in the project.
In an environment where a user doesn't share workspaces this file can be ignored, however if there is related projects in the same workspace which share configuration then this file should not be ignored (ref).
This rule was added because I am working on an assumption that when applying a .gitignore
file to an Xcode
project the intention is to share that project with other developers and if not, to keep your project as clean as possible yet retaining core configuration across project life-cycles.
This can be done either as part of a team or generally via public SCM (e.g. Github) so the need to include contents.xcworkspacedata
is important in order to share workspace and project information with other members, as well as yourself, especially if there are related projects in the same workspace.
This thread discusses how .gcno
files are used to manage code coverage information and the Apple docs give further information. Not only do these files contain coverage information but they also contain profile data stored in a platform-independent format.
The .gcno
files are placed in the same directory as a build object file and are used with the gcc
compiler. They should therefore not be included in a source code repository as they are very build specific and can mess with other members build configuration settings if committed to a repository.