Skip to content

Various synced folder enhancements#1596

Merged
yonaskolb merged 5 commits intoyonaskolb:masterfrom
macguru:explicit-folders
Mar 5, 2026
Merged

Various synced folder enhancements#1596
yonaskolb merged 5 commits intoyonaskolb:masterfrom
macguru:explicit-folders

Conversation

@macguru
Copy link
Copy Markdown
Contributor

@macguru macguru commented Mar 3, 2026

This PR addresses a couple of additional things of syncedFolder sources:

  • Feature: Adds an explicitFolders property to TargetSource that is passed through to PBXFileSystemSynchronizedRootGroup, to turn entire subfolders into Resources.
  • Fixed synced folders ignoring createIntermediateGroups=YES and always beging created at the root level.
  • Allow synced folders to be sorted using groupOrdering.
  • Fix membership exceptions not working for nested synced folders with intermediate groups enabled.

Note that this PR builds on #1587 by @mirkokg in two ways:

  • The explicitFolders setting only works correctly with the empty Resources phase introduced there.
  • The last commit fixes a shortcoming of the membership exception support added there as well, that is not observable without intermediate groups working correctly.

@macguru
Copy link
Copy Markdown
Contributor Author

macguru commented Mar 3, 2026

Sorry that this includes the full other PR, didn't know how to do it differently. 😬

macguru added 5 commits March 4, 2026 10:19
Adds an `explicitFolders` property to `TargetSource` that is expanded from Glob patterns and passed through to `PBXFileSystemSynchronizedRootGroup`.
When createIntermediateGroups was enabled and a syncedFolder source had a
multi-component path (e.g. SyncedParent/SyncedChild), two things went wrong:

1. The synced folder was unconditionally added to rootGroups, causing it
   to appear both at the project root and inside the correct intermediate
   parent group.

2. The synced folder kept its full project-relative path instead of being
   made relative to its parent group, so Xcode concatenated them into a
   wrong path (e.g. SyncedParent/SyncedParent/SyncedChild).
@macguru macguru force-pushed the explicit-folders branch from 74ef859 to c89ca14 Compare March 4, 2026 09:22
@macguru
Copy link
Copy Markdown
Contributor Author

macguru commented Mar 4, 2026

@yonaskolb now that #1587 is merged (thanks!), I've rebased my changes onto master. Please let me know if you'd like me to do any changes.

Copy link
Copy Markdown
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR @macguru, nice work

@yonaskolb yonaskolb merged commit 167d119 into yonaskolb:master Mar 5, 2026
3 checks passed
yonaskolb added a commit that referenced this pull request Mar 10, 2026
…diateGroups

Skip makePathRelative for folder-type sources since they use sourceTree
.sourceRoot and need the full project-relative path preserved. The call
was inadvertently added for all source types in #1596 but only synced
folders (.syncedFolder) need it.

Fixes #1603
yonaskolb added a commit that referenced this pull request Mar 10, 2026
…diateGroups (#1605)

Skip makePathRelative for folder-type sources since they use sourceTree
.sourceRoot and need the full project-relative path preserved. The call
was inadvertently added for all source types in #1596 but only synced
folders (.syncedFolder) need it.

Fixes #1603
yonaskolb added a commit that referenced this pull request Mar 12, 2026
…ers (#1606)

`makePathRelative` used `project.basePath` to compute parent paths, while
`resolveGroupPath` used `projectDirectory ?? project.basePath`. When these
differ (e.g. via --project flag), intermediate group paths become inconsistent,
causing Xcode to resolve files to the wrong location.

Regression from #1596 which added the `makePathRelative` call in the
`createIntermediateGroups` code path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
yonaskolb added a commit that referenced this pull request Mar 12, 2026
…ers (#1608)

* Fix makePathRelative using wrong base path when projectDirectory differs (#1606)

`makePathRelative` used `project.basePath` to compute parent paths, while
`resolveGroupPath` used `projectDirectory ?? project.basePath`. When these
differ (e.g. via --project flag), intermediate group paths become inconsistent,
causing Xcode to resolve files to the wrong location.

Regression from #1596 which added the `makePathRelative` call in the
`createIntermediateGroups` code path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Extract basePath computed property in SourceGenerator

Consolidates `projectDirectory ?? project.basePath` into a single
`basePath` property to prevent future mismatches between path resolution
call sites.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants