Skip to content

Write lastKnownFileType = text for unknown file types - #3374

Merged
brentleyjones merged 1 commit into
MobileNativeFoundation:mainfrom
erneestoc:ec/match-xcode-comments
Oct 13, 2026
Merged

brentleyjones merged 1 commit into
MobileNativeFoundation:mainfrom
erneestoc:ec/match-xcode-comments

Conversation

@erneestoc

@erneestoc erneestoc commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

Xcode rewrites `project.pbxproj` when it saves a project whose file
differs from how it would serialize it. For files with extensions it
doesn't know (e.g. `.graphql`, `LICENSE`), Xcode sniffs the contents and
writes `text` for text files, while we wrote `file`. Unknown files in
source trees are overwhelmingly text, so write `text` instead.

Signed-off-by: Ernesto Cambuston <e.cambuston@gmail.com>
@erneestoc
erneestoc force-pushed the ec/match-xcode-comments branch from 3a05716 to ec3207e Compare October 9, 2026 21:23
@erneestoc erneestoc changed the title Match Xcode's comments, file types, and target attribute order Write lastKnownFileType = text for unknown file types Oct 9, 2026
@brentleyjones
brentleyjones merged commit c6695d8 into MobileNativeFoundation:main Oct 13, 2026
10 checks passed
brentleyjones pushed a commit that referenced this pull request Oct 13, 2026
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.

Signed-off-by: Ernesto Cambuston <e.cambuston@gmail.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