The .xcodeproj file bundle has multiple files inside of it. The generators
in this package are responsible for creating those various files.
The most important file in the .xcodeproj file bundle is the project.pbxproj
file. This file details the project itself, and controls almost all of Xcode’s
behavior related to the project. Other projects, such as
XcodeProj, call the type that this file
represents “PBXProj”, so we will too from here on.
Instead of there being a single generator for PBXProj, there are multiple,
with each generating a portion of the end file. These portions are called
“partials”. These partials are concatenated together to form the final
project.pbxproj file. We use this approach for a couple reasons:
- Each generator only needs a subset of the total inputs needed to generate the
full
PBXProj. This means that when the project changes, not every generator will need to run, resulting in faster project generation. - Each generator can receive “raw” input, reducing the amount of Bazel analysis phase CPU time and memory retained, resulting in faster project generation and lower Bazel server constant memory usage.
Below is a list of the PBXProj partial generators, and a high level
description of what each one does. Please see their associated READMEs for more
information.
pbxproj_prefix:- The start of the
PBXProjelement - All of the
BazelDependenciesrelated objects:Generate Bazel Dependenciesscript build phaseCreate swift_debug_settings.pyscript build phaseXCBuildConfigurationXCBuildConfigurationList
BazelDependenciesPBXAggregateTarget- All of the
PBXProjectrelated objects:XCBuildConfigurationXCBuildConfigurationList
- The start of the
PBXProjectelement - Contains all
PBXProjectproperties except forattributes.TargetAttributes,targets, andknownRegions
- The start of the
pbxtargetdependencies:- Creates four+ files:
- A partial containing the
PBXTargetDependencyandPBXContainerItemProxyobjects - A partial containing the
PBXProject.attributes.TargetAttributesproperty - A partial containing:
- The
PBXProject.targetsproperty - Closes the
PBXProjectelement
- The
- A set of files, each detailing how a set of configured targets are consolidated together
- A partial containing the
- Creates four+ files:
target_build_settings:- Run once for each target
- Each target generates a file that contains one or more build settings:
DEBUG_INFORMATION_FORMATOTHER_CFLAGSOTHER_SWIFT_FLAGSSWIFT_COMPILATION_MODE- etc.
pbxnativetargets:- Run once on each shard of all the targets
- Each shard creates two or more files:
- A partial containing all of the
PBXNativeTargetrelated objects:PBXNativeTargetXCBuildConfigurationXCBuildConfigurationList- and various build phases
- A file that maps
PBXBuildFileidentifiers to file paths
- A partial containing all of the
files_and_groups:- Creates three files:
- A partial containing the
PBXProject.knownRegionsproperty - A partial containing:
PBXFileReferencesPBXGroupsPBXBuildFiles- Closes the
PBXProjelement
- A file containing a string for the
RESOLVED_REPOSITORIESbuild setting
- A partial containing the
- Creates three files:
Both automatic schemes and
custom schemes are generated by the
xcschemes generator.