XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

"file reference member of multiple groups" warning in Xcode 10

Open LinusU opened this issue 7 years ago • 11 comments

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

LinusU avatar Sep 19 '18 11:09 LinusU

Hi @LinusU. Was your version of XcodeGen compiled with Swift 4.2?

yonaskolb avatar Sep 29 '18 07:09 yonaskolb

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.

LinusU avatar Sep 29 '18 08:09 LinusU

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 😄👍

yonaskolb avatar Sep 29 '18 11:09 yonaskolb

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 avatar Oct 02 '18 07:10 LinusU

@LinusU is this still an issue for you?

yonaskolb avatar Dec 05 '18 07:12 yonaskolb

Yes, sorry for not providing more info 😓

Still an issue in 2.0.0

LinusU avatar Dec 05 '18 10:12 LinusU

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

LinusU avatar Dec 05 '18 11:12 LinusU

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 😂

LinusU avatar Dec 05 '18 12:12 LinusU

@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

LinusU avatar Dec 05 '18 12:12 LinusU

I was able to workaround this by adding createIntermediateGroups: true option to the (root) options section of .yml.

grigorye avatar Feb 20 '20 16:02 grigorye

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

xxi511 avatar Sep 02 '22 06:09 xxi511