Skip to content

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

Description

@Ckitakishi

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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