Skip to content

Fix membershipExceptions for localized files in synced folders#1616

Open
AlexNsbmr wants to merge 1 commit intoyonaskolb:masterfrom
AlexNsbmr:fix/localized-membership-exceptions-synced-folders
Open

Fix membershipExceptions for localized files in synced folders#1616
AlexNsbmr wants to merge 1 commit intoyonaskolb:masterfrom
AlexNsbmr:fix/localized-membership-exceptions-synced-folders

Conversation

@AlexNsbmr
Copy link
Copy Markdown
Contributor

@AlexNsbmr AlexNsbmr commented Apr 16, 2026

Description

  • Localized files (.strings inside .lproj directories) in synced folders were not properly excluded via membershipExceptions when using includes filters
  • Xcode expects a /Localized: prefix format (e.g., /Localized: Resources/AppShortcuts.strings) for variant-group membership exceptions, but XcodeGen was generating individual per-language paths (e.g., Resources/de.lproj/AppShortcuts.strings)
  • These per-language paths were silently ignored by Xcode, causing localized resources to leak into targets that should have excluded them

Fix

In configureMembershipExceptions(), paths containing .lproj directory components are now transformed into the /Localized: variant-group format that Xcode expects.

Before (ignored by Xcode):

Resources/de.lproj/AppShortcuts.strings,
Resources/fr.lproj/AppShortcuts.strings,

After (honored by Xcode):

"/Localized: Resources/AppShortcuts.strings",

How to reproduce

  1. Create a project with defaultSourceDirectoryType: syncedFolder
  2. Add a target that references a synced folder with includes filtering only specific files
  3. The synced folder contains .lproj directories with .strings files
  4. After generation, .strings files appear as members of the target despite not being in includes
  5. This causes build warnings like "This phrase is not used in any App Shortcut" for AppShortcuts.strings being processed by unrelated targets

@AlexNsbmr AlexNsbmr force-pushed the fix/localized-membership-exceptions-synced-folders branch 4 times, most recently from e79938d to a605d1d Compare April 16, 2026 09:36
Xcode uses a `/Localized:` prefix format for membership exceptions
of localized files in synced folders (e.g., `/Localized: Resources/AppShortcuts.strings`),
rather than individual per-language paths (e.g., `Resources/de.lproj/AppShortcuts.strings`).

Previously, XcodeGen generated per-language `.lproj` paths as membership
exceptions, which Xcode silently ignored. This caused localized resources
(`.strings` files inside `.lproj` directories) to remain as members of
targets that should have excluded them via `includes`/`excludes` filters.

This fix detects paths containing `.lproj` directory components and
transforms them into the `/Localized:` variant-group format that Xcode
expects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AlexNsbmr AlexNsbmr force-pushed the fix/localized-membership-exceptions-synced-folders branch from a605d1d to 0fcbd8a Compare April 16, 2026 09:41
@AlexNsbmr AlexNsbmr marked this pull request as ready for review April 16, 2026 10:04
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