yonaskolb / yonaskolb/XcodeGen

Subdirectory PBXGroup is also added to the main group, so Xcode 27.2 cannot open the project

Open
#1,651 0 comments 2 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 a target source resolves to the spec's own directory, XcodeGen can add a subdirectory PBXGroup to both its parent source group and the main group. This commonly occurs when project.yml is inside the module directory and uses sources: [../Module].

xcodegen generate exits successfully and prints no warning.

The same malformed structure was reported only as a warning in Xcode 10 (#405). Xcode 27.2 rejects it and cannot open the generated project. Its hierarchical project format does not allow a group to be a child of multiple groups.

Reproduction

Module/
├── project.yml
├── Extension/
│   └── a.swift
└── b.swift

Module/project.yml:

name: Module

targets:
  Module:
    type: framework
    platform: iOS
    sources:
      - ../Module
cd Module
xcodegen generate
xcodebuild -list -project Module.xcodeproj

Actual behavior

The generated project.pbxproj references the same Extension group from both Module and the main group:

0FFF97BD... /* Module */ = {
    isa = PBXGroup;
    children = (
        46BFE1FF... /* b.swift */,
        13188FF9... /* Extension */,
    );
    name = Module;
    path = .;
    sourceTree = "<group>";
};
AEF60E6A... /* main group */ = {
    isa = PBXGroup;
    children = (
        13188FF9... /* Extension */,
        0FFF97BD... /* Module */,
        ...
    );
    sourceTree = "<group>";
};

Xcode 27.2 fails to load the project:

xcodebuild: error: Unable to read project 'Module.xcodeproj'.
Reason: Could not open “Module”

The “PBXGroup” with ID “AEF60E6A...” has an invalid value for “children”.
The reference "Extension" is a member of more than one group, which is not allowed.

Expected behavior

Each PBXGroup should be a child of at most one group, and the generated project should open successfully in Xcode 27.2.

Environment

  • XcodeGen: master
  • Xcode 27.2 beta (27B5019j): fails to open the project
  • Xcode 27.0: opens the same project and keeps one membership

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

Reproduce the issue from the described Module/project.yml using xcodegen generate, then inspect the generated Module.xcodeproj/project.pbxproj and its PBXGroup memberships. The work is done when each group has at most one parent and xcodebuild -list -project Module.xcodeproj opens successfully under Xcode 27.2.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.