"file reference member of multiple groups" warning in Xcode 10
After upgrading to Xcode 10, I'm getting the following warning when building my project:
2018-09-19 13:29:32.267 xcodebuild[17317:5682171] warning: The file reference for "Sources/Components" is a member of multiple groups ("Sources" and ""); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.
2018-09-19 13:29:32.267 xcodebuild[17317:5682171] warning: The file reference for "Sources/Coordinators" is a member of multiple groups ("Sources" and ""); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.
2018-09-19 13:29:32.267 xcodebuild[17317:5682171] warning: The file reference for "Sources/Extensions" is a member of multiple groups ("Sources" and ""); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.
2018-09-19 13:29:32.287 xcodebuild[17317:5682171] warning: The file reference for "Sources/Pages" is a member of multiple groups ("Sources" and ""); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.
2018-09-19 13:29:32.287 xcodebuild[17317:5682171] warning: The file reference for "Sources/Stores" is a member of multiple groups ("Sources" and ""); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.
My directory structure looks like this:
Sources/
Components/
*.swift
Coordinators/
*.swift
Extensions/
*.swift
Pages/
*.swift
Stores/
*.swift
*.swift
project.yml
Hi @LinusU. Was your version of XcodeGen compiled with Swift 4.2?
I'm getting the warning both on a version compiled with an older version (I guess Swift 4.1, XcodeGen version 1.7.0), and with the newer version 1.11.2 compiled with Swift 4.2.
Could you share some more details of your spec? Do multiple targets use the same source paths?
Better yet if you could submit a PR to the TestProject fixture that highlighted the issue, even better 😄👍
Sorry for the lack of detail ☺️
I have multiple targets that use the same paths, it looks something like this (very simplified):
name: Ctrlpanel
options:
bundleIdPrefix: com.ctrlaltdeseat
targets:
Ctrlpanel:
type: application
platform: iOS
deploymentTarget: "12.0"
sources:
- path: Sources
excludes:
- AppInfo.plist
- Coordinators/FindLogin.swift
- CredentialProvider.swift
- CredentialProviderInfo.plist
settings:
INFOPLIST_FILE: Sources/AppInfo.plist
dependencies:
- target: CredentialProvider
CredentialProvider:
type: app-extension
platform: iOS
deploymentTarget: "12.0"
sources:
- path: Sources/Assets.xcassets
- path: Sources/Constants.swift
- path: Sources/Coordinators/FindLogin.swift
- path: Sources/CredentialProvider.swift
- path: Sources/LaunchScreen.storyboard
- path: Sources/Pages/AccountList.swift
- path: Sources/Pages/Unlock.swift
- path: Sources/Settings.swift
- path: Sources/Stores/Auth.swift
settings:
INFOPLIST_FILE: Sources/CredentialProviderInfo.plist
I'll try and submit a PR as soon as I get some time 👍
@LinusU is this still an issue for you?
Yes, sorry for not providing more info 😓
Still an issue in 2.0.0
Hmm, I tried to reproduce it here, but haven't been able to yet 🤔
https://github.com/yonaskolb/XcodeGen/compare/master...LinusU:warning-test-case
Really went down the rabbit hole on this one. The bug is only triggered with certain app names 😂
e.g. Ctrlpanel and Ctrlalala triggers the behaviour, but AppWithExtension and BiBaBo doesn't 😮
edit: DishWasher triggers the bug, but AishWasher doesn't, seems to have something to do with lexicographical ordering 🤔
edit2: Credentiaq triggers the bug, but Crendetiaa doesn't 😂
@yonaskolb okay, I've added a test case here: https://github.com/yonaskolb/XcodeGen/compare/master...LinusU:warning-test-case
I did the following to see it:
cd Tests/Fixtures/TestProject
mint run yonaskolb/xcodegen
xcodebuild -project Project.xcodeproj -target Zapp -quiet CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
The first line of the output is the warning
I was able to workaround this by adding createIntermediateGroups: true option to the (root) options section of .yml.
Just have this issue.
In my case, it is caused by typo.
e.g. some place is Sources/Components and some place is Sources/components