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
Summary
When a target source resolves to the spec's own directory, XcodeGen can add a subdirectory
PBXGroupto both its parent source group and the main group. This commonly occurs whenproject.ymlis inside the module directory and usessources: [../Module].xcodegen generateexits 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:cd Module xcodegen generate xcodebuild -list -project Module.xcodeprojActual behavior
The generated
project.pbxprojreferences the sameExtensiongroup from bothModuleand the main group:Xcode 27.2 fails to load the project:
Expected behavior
Each
PBXGroupshould be a child of at most one group, and the generated project should open successfully in Xcode 27.2.Environment
master27B5019j): fails to open the project