Fix localized files leaking into synced folder targets#1633
Open
AlexNsbmr wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
fix/synced-folder-localized-exceptions
branch
from
July 20, 2026 13:40
affcd6c to
ad8a745
Compare
AlexNsbmr
marked this pull request as ready for review
July 20, 2026 13:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 viaincludes:/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: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):
In practice this leaks e.g.
AppShortcuts.stringsinto app extensions / UI-test targets that have noAppShortcutsProvider, 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*.lprojdirectory to the/Localized:variant-group form (with the.lprojcomponent removed). The surroundingSetdedupes the per-language entries into one.Verified
project.ymlchange.