Skip to content

XcodeGen incorrectly handles local Swift packages, causing GUID collisions and incorrect project structure #1575

@mckapur

Description

@mckapur

Summary

When migrating an iOS project to XcodeGen, local Swift packages (Firmware and GraphQL) that work correctly in the
original Xcode project are being improperly added to the generated project. Instead of being referenced as
proper Swift Package Dependencies, they appear under the main target's "Packages" folder as file references,
causing GUID collision errors during build.

Current Behavior

  1. Local packages defined in project.yml are added as file references under Backbone/Packages/ in the project
    navigator
  2. Build fails with error: The workspace contains multiple references with the same GUID 'PACKAGE:...'
  3. Packages don't appear under "Package Dependencies" where they should be

Expected Behavior

  1. Local packages should appear under "Package Dependencies" in the project navigator (not under the main target)
  2. Should be referenced using XCLocalSwiftPackageReference (Xcode 15+ standard)
  3. No GUID collision errors during build

Steps to Reproduce

  1. Define local packages in project.yml:
    packages:
    Firmware:
    path: Backbone/Accessory/Firmware
    GraphQL:
    path: Backbone/Generated/GraphQL

targets:
Backbone:
dependencies:
- package: Firmware
- package: GraphQL
2. Run xcodegen generate
3. Open project and attempt to build
4. Observe GUID collision error

Technical Details

Original Xcode project references (working):
98CE7DD82C758068002132DC /* XCLocalSwiftPackageReference "Backbone/Accessory/Firmware" /
98935C362DD67B3D009F17FE /
XCLocalSwiftPackageReference "Backbone/Generated/GraphQL" */

XcodeGen generated references (broken):

  • Creates file references instead of package references
  • Places packages under main target's file hierarchy
  • Results in duplicate GUID errors

Attempted Workarounds (all failed)

  1. Using localPackages feature in project.yml
  2. Post-generation Ruby script to add XCLocalSwiftPackageReference
  3. Various dependency configurations (product names, explicit targets)
  4. Workspace configurations

Impact

  • Prevents successful migration to XcodeGen for projects using local Swift packages
  • Blocks builds with "Could not compute dependency graph" errors
  • Forces manual Xcode project maintenance instead of declarative configuration

Environment

  • XcodeGen version: 2.44.1
  • Xcode version: 15+
  • Swift version: 5.0
  • Platform: iOS

Additional Context

  • Local packages contain legitimate Swift Package Manager packages with Package.swift files
  • Same packages work correctly when added through Xcode's UI
  • Issue appears to be fundamental limitation in how XcodeGen handles local package references
  • Package resolution also affected - only downloads 3 packages then halts

Related Files

  • /Backbone/Accessory/Firmware/Package.swift - Local firmware package
  • /Backbone/Generated/GraphQL/Package.swift - Local GraphQL package (Apollo iOS generated)
  • Both packages have proper Swift Package Manager structure with Sources directories

This appears to be a fundamental incompatibility between XcodeGen's file-based approach and Xcode's native local
package reference system introduced in recent versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions