yonaskolb / yonaskolb/XcodeGen

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

Open
#1,575 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the project.yml packages and target dependencies, then run xcodegen generate using the local Firmware and GraphQL Package.swift paths. Compare the generated project references with the XCLocalSwiftPackageReference entries shown in the issue. Done means both packages appear under Package Dependencies, not as file references, and the GUID collision and dependency-graph errors no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.