Skip to content

Fix synced folder issues: configFiles duplicate, group insertion, and directory-level membershipExceptions#1607

Open
AlexNsbmr wants to merge 4 commits intoyonaskolb:masterfrom
AlexNsbmr:fix/configfiles-synced-folder-duplicate
Open

Fix synced folder issues: configFiles duplicate, group insertion, and directory-level membershipExceptions#1607
AlexNsbmr wants to merge 4 commits intoyonaskolb:masterfrom
AlexNsbmr:fix/configfiles-synced-folder-duplicate

Conversation

@AlexNsbmr
Copy link

@AlexNsbmr AlexNsbmr commented Mar 11, 2026

Description

Three related fixes for defaultSourceDirectoryType: syncedFolder support.

1. configFiles creating duplicate groups

When using configFiles that reference paths inside a synced folder source, a duplicate PBXGroup is created alongside the PBXFileSystemSynchronizedRootGroup.

options:
  defaultSourceDirectoryType: syncedFolder

configFiles:
  Debug: Sources/Config/debug.xcconfig
  Release: Sources/Config/release.xcconfig

targets:
  App:
    sources: [Sources]

Root cause: getContainedFileReference() always creates a PBXGroup hierarchy via getGroup(), regardless of whether the file lives inside a synced folder. Same class of issue as #1602, but for configFiles.

Fix: Return a file reference with sourceTree: .sourceRoot when the path is inside a synced folder, skipping group creation entirely.

2. Root group duplication for paths inside synced folders

When multiple targets reference a synced folder path (e.g., extension targets with type: syncedFolder), getGroup() inserts the group into rootGroups, causing a duplicate entry in the project navigator.

Fix: Skip rootGroups insertion when the path is inside an existing synced folder.

3. Directory-level membershipExceptions not working

When using includes on a synced folder source, findExceptions adds directory names to membershipExceptions instead of individual file paths. Xcode does not recursively exclude directory contents from membership exceptions, leading to:

  • "Multiple commands produce Info.plist" build errors (e.g., Supporting Files/ directory in exceptions doesn't exclude Supporting Files/Info.plist)
  • Wrong target membership for files in non-included directories (e.g., files incorrectly added to extension targets)
# Example: extension target cherry-picking files from shared synced folder
NotificationServiceExtension:
  sources:
    - path: Sources
      type: syncedFolder
      includes:
        - Notifications/NotificationPayload.swift

Fix: Recurse into non-included directories in findExceptions to list individual file paths instead of directory names.

Tests

  • Existing test: does not create duplicate group for configFiles inside synced folder
  • Existing tests for synced folder includes cover the membershipExceptions behavior

Environment

  • XcodeGen: 2.45.3
  • Xcode: 16
  • macOS: Sequoia

@AlexNsbmr AlexNsbmr marked this pull request as draft March 11, 2026 10:28
@AlexNsbmr AlexNsbmr force-pushed the fix/configfiles-synced-folder-duplicate branch 3 times, most recently from f5b01a8 to 7f1fefa Compare March 11, 2026 10:40
When configFiles reference paths inside a synced folder source,
getContainedFileReference() created a separate PBXGroup hierarchy
that duplicated the PBXFileSystemSynchronizedRootGroup already
managing those files.

Skip group creation in getContainedFileReference when the file
path falls inside an existing synced folder root.

Fixes the same class of issue as yonaskolb#1602, but for configFiles
rather than target sources.
@AlexNsbmr AlexNsbmr force-pushed the fix/configfiles-synced-folder-duplicate branch from 7f1fefa to 391bd18 Compare March 11, 2026 10:43
@AlexNsbmr AlexNsbmr marked this pull request as ready for review March 11, 2026 10:44
@AlexNsbmr AlexNsbmr marked this pull request as draft March 11, 2026 10:46
…eptions

- Prevent rootGroups insertion for paths inside synced folders,
  avoiding duplicate PBXGroup alongside PBXFileSystemSynchronizedRootGroup
- Recurse into non-included directories in findExceptions to list
  individual file paths instead of directory names, since Xcode does
  not recursively exclude directory contents from membershipExceptions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AlexNsbmr AlexNsbmr changed the title Fix configFiles creating duplicate group inside synced folder Fix synced folder issues: configFiles duplicate, group insertion, and directory-level membershipExceptions Mar 11, 2026
@AlexNsbmr AlexNsbmr marked this pull request as ready for review March 11, 2026 15:45
@AlexNsbmr AlexNsbmr marked this pull request as draft March 11, 2026 15:46
…in exceptions

Xcode does not recursively exclude directory contents from
membershipExceptions, so the correct behavior is to list individual
files rather than directory names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AlexNsbmr AlexNsbmr marked this pull request as ready for review March 11, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant