Skip to content

Sort TargetAttributes by identifier - #3380

Merged
brentleyjones merged 1 commit into
MobileNativeFoundation:mainfrom
erneestoc:ec/sorted-target-attributes
Oct 13, 2026
Merged

brentleyjones merged 1 commit into
MobileNativeFoundation:mainfrom
erneestoc:ec/sorted-target-attributes

Conversation

@erneestoc

Copy link
Copy Markdown
Contributor

Split out of #3374, per review.

Xcode writes dictionary keys sorted. We wrote TargetAttributes with BazelDependencies (FF01…) first and then the targets in generation order, so Xcode rewrote project.pbxproj the next time it saved the project. TargetAttributes is a dictionary nested in the PBXProject object that pbxtargetdependencies writes as a whole, so the final assembly doesn't reorder it.

CreateTargetAttributesObjects now returns the objects sorted by identifier. CalculateTargetAttributesPartial still expects a pre-sorted list.

Xcode rewrites `project.pbxproj` when it saves a project whose file
differs from how it would serialize it. It writes dictionary keys
sorted, but we wrote `TargetAttributes` with `BazelDependencies` first
and then the targets in generation order.

Signed-off-by: Ernesto Cambuston <e.cambuston@gmail.com>
@erneestoc
erneestoc requested a review from a team as a code owner October 9, 2026 21:23
brentleyjones pushed a commit that referenced this pull request Oct 13, 2026
For files with extensions Xcode doesn't know (e.g. `.graphql`,
`LICENSE`), Xcode sniffs the contents and writes `lastKnownFileType =
text` for text files. We wrote `file`, so Xcode rewrote
`project.pbxproj` the next time it saved the project. Unknown files in
source trees are overwhelmingly text, so we now write `text`.

The group comment, project name and `TargetAttributes` ordering changes
that were here are now in #3379 and #3380.

Signed-off-by: Ernesto Cambuston <e.cambuston@gmail.com>
@brentleyjones
brentleyjones merged commit 5682d4a into MobileNativeFoundation:main Oct 13, 2026
9 checks passed
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