Skip to content

Latest commit

 

History

History

README.md

.xcodeproj generators

The .xcodeproj file bundle has multiple files inside of it. The generators in this package are responsible for creating those various files.

PBXProj

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 PBXProj element
    • All of the BazelDependencies related objects:
      • Generate Bazel Dependencies script build phase
      • Create swift_debug_settings.py script build phase
      • XCBuildConfiguration
      • XCBuildConfigurationList
    • BazelDependencies PBXAggregateTarget
    • All of the PBXProject related objects:
      • XCBuildConfiguration
      • XCBuildConfigurationList
    • The start of the PBXProject element
    • Contains all PBXProject properties except for attributes.TargetAttributes, targets, and knownRegions
  • pbxtargetdependencies:
    • Creates four+ files:
      • A partial containing the PBXTargetDependency and PBXContainerItemProxy objects
      • A partial containing the PBXProject.attributes.TargetAttributes property
      • A partial containing:
        • The PBXProject.targets property
        • Closes the PBXProject element
      • A set of files, each detailing how a set of configured targets are consolidated together
  • target_build_settings:
    • Run once for each target
    • Each target generates a file that contains one or more build settings:
      • DEBUG_INFORMATION_FORMAT
      • OTHER_CFLAGS
      • OTHER_SWIFT_FLAGS
      • SWIFT_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 PBXNativeTarget related objects:
        • PBXNativeTarget
        • XCBuildConfiguration
        • XCBuildConfigurationList
        • and various build phases
      • A file that maps PBXBuildFile identifiers to file paths
  • files_and_groups:
    • Creates three files:
      • A partial containing the PBXProject.knownRegions property
      • A partial containing:
        • PBXFileReferences
        • PBXGroups
        • PBXBuildFiles
        • Closes the PBXProj element
      • A file containing a string for the RESOLVED_REPOSITORIES build setting

Xcode schemes

Both automatic schemes and custom schemes are generated by the xcschemes generator.