Skip to content

Fix localized files leaking into synced folder targets#1633

Open
AlexNsbmr wants to merge 1 commit into
yonaskolb:masterfrom
AlexNsbmr:fix/synced-folder-localized-exceptions
Open

Fix localized files leaking into synced folder targets#1633
AlexNsbmr wants to merge 1 commit into
yonaskolb:masterfrom
AlexNsbmr:fix/synced-folder-localized-exceptions

Conversation

@AlexNsbmr

@AlexNsbmr AlexNsbmr commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Problem

When a target uses a synced folder and that folder contains localized resources (*.lproj/Foo.strings), the localized files become members of every target syncing the folder, even when a target excludes them via includes:/excludes:.

XcodeGen does write the excluded localized files into the target's PBXFileSystemSynchronizedBuildFileExceptionSet.membershipExceptions, but Xcode ignores them, because they use the per-language path form:

Resources/en.lproj/AppShortcuts.strings

Xcode only honors localized exclusions in the variant-group form (the same thing Xcode writes when you uncheck a localized file's target membership in the File inspector):

/Localized: Resources/AppShortcuts.strings

In practice this leaks e.g. AppShortcuts.strings into app extensions / UI-test targets that have no AppShortcutsProvider, producing build warnings like "This phrase is not used in any App Shortcut or as a Negative Phrase" and "Unable to read App Intents metadata, AppShortcuts phrases will go through basic validation".

Fix

In PBXProjGenerator.configureMembershipExceptions, rewrite exception paths for files inside a *.lproj directory to the /Localized: variant-group form (with the .lproj component removed). The surrounding Set dedupes the per-language entries into one.

Verified

  • New unit test passes.
  • Confirmed on a real multi-target project (app + widget + notification-service + UI-tests): with the fix, the localized app-only strings are excluded from the secondary targets, the app itself keeps them, and the App Intents build warnings are gone with no project.yml change.

Localized .lproj files were excluded from synced folder targets using
per-language membership exception paths (e.g. Resources/en.lproj/Foo.strings),
which Xcode silently ignores, so the files stayed members of every target
syncing the folder.

Emit the variant-group form Xcode honors (/Localized: Resources/Foo.strings),
collapsed across languages, so includes/excludes work for localized resources.
@AlexNsbmr
AlexNsbmr force-pushed the fix/synced-folder-localized-exceptions branch from affcd6c to ad8a745 Compare July 20, 2026 13:40
@AlexNsbmr
AlexNsbmr marked this pull request as ready for review July 20, 2026 13:43
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