yonaskolb / yonaskolb/XcodeGen
XcodeGen incorrectly handles local Swift packages, causing GUID collisions and incorrect project structure
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
- Local packages defined in project.yml are added as file references under Backbone/Packages/ in the project
navigator - Build fails with error: The workspace contains multiple references with the same GUID 'PACKAGE:...'
- Packages don't appear under "Package Dependencies" where they should be
Expected Behavior
- Local packages should appear under "Package Dependencies" in the project navigator (not under the main target)
- Should be referenced using XCLocalSwiftPackageReference (Xcode 15+ standard)
- No GUID collision errors during build
Steps to Reproduce
- 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)
- Using localPackages feature in project.yml
- Post-generation Ruby script to add XCLocalSwiftPackageReference
- Various dependency configurations (product names, explicit targets)
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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