Skip to content

feat: Xcode 26.3 format updates#1078

Open
macguru wants to merge 4 commits intotuist:mainfrom
macguru:bugfix/xcode-26-3-format
Open

feat: Xcode 26.3 format updates#1078
macguru wants to merge 4 commits intotuist:mainfrom
macguru:bugfix/xcode-26-3-format

Conversation

@macguru
Copy link

@macguru macguru commented Mar 12, 2026

Updates xcscheme and pbxproj serialization to better match the format written by Xcode 26.3.

Short description 📝

Opening projects generated with XcodeProj creates diffs in the generated files. I understand this is an endless cat-and-mice game, but thought it's generally a design aspect of this project, to get as close to what Xcode does as possible. As such, I've taken the chance and addressed the things that came to my attention, with absolutely no guarantee these are complete or anything. They just address the issues I've ran into.

Solution 📦

The changes are mostly just formatting fixes, some default value changes and one minor code extension to comments generated for synchronized folder exceptions.

Implementation 👩‍💻👨‍💻

Changes to XCScheme

  • Reorder TestAction children: MacroExpansion, CommandLineArguments, EnvironmentVariables now precede TestPlans and Testables
  • Reorder LaunchAction children: CommandLineArguments and EnvironmentVariables now precede LocationScenarioReference
  • Add TestPlanReference to attribute ordering (reference before default)
  • Add customLaunchCommand to LaunchAction attribute ordering (between debugDocumentVersioning and debugServiceExtension)
  • Omit empty Testables and CommandLineArguments elements (Xcode strips them when empty)
  • Write runPostActionsOnFailure, onlyGenerateCoverageForSpecifiedTargets, and useTestSelectionWhitelist attributes only when true (Xcode strips the redundant "NO" default)
  • Fix useTestSelectionWhitelist parsing to distinguish absent (nil) from explicitly set to "NO"

Changes to PBXProj

  • Add xctestplantext to the file type table so .xctestplan references get lastKnownFileType = text
  • Omit empty explicitFileTypes and explicitFolders on PBXFileSystemSynchronizedRootGroup
  • Omit name from PBXFileSystemSynchronizedRootGroup when it is identical to path, matching Xcode's normalization
  • Generate descriptive plist comments for PBXFileSystemSynchronizedExceptionSet classes

Notes 📝

The very last change is a bit more complex, since the comments need more info than currently present in the classes. Introduce a plistComment property on PBXFileSystemSynchronizedExceptionSet (base, returns ISA) and override it in subclasses to produce Xcode 26.3's format: Exceptions for "<folder>" folder in "<target>" target. The back-reference to the owning root group is established via an assignParentToChildren() override, consistent with how PBXFileElement.parent is wired up for the group hierarchy.

I've also updated tests and hope the changes match the projects style. Happy to make any changes as needed.

macguru added 4 commits March 12, 2026 12:24
- Reorder TestAction children: MacroExpansion, CommandLineArguments, EnvironmentVariables now precede TestPlans and Testables
- Reorder LaunchAction children: CommandLineArguments and   EnvironmentVariables now precede LocationScenarioReference
- Omit empty Testables and CommandLineArguments elements instead of writing empty XML tags
- Only write runPostActionsOnFailure, onlyGenerateCoverageForSpecifiedTargets, and useTestSelectionWhitelist attributes when true (Xcode strips the redundant "NO" default)
- Fix useTestSelectionWhitelist parsing to distinguish absent (nil) from explicitly set to "NO"
- Add TestPlanReference to attribute ordering (reference before default)
- Add customLaunchCommand to LaunchAction attribute ordering (between debugDocumentVersioning and debugServiceExtension)
- Update test fixtures to match new serialization output

Made-with: Cursor
- Add `xctestplan` → `text` to the file type table so `.xctestplan` references get `lastKnownFileType = text`
- Skip serializing `explicitFileTypes` and `explicitFolders` on `PBXFileSystemSynchronizedRootGroup` when empty
- Omit `name` from `PBXFileSystemSynchronizedRootGroup` when it is identical to `path`, matching Xcode's normalization

Made-with: Cursor
…ptionSet classes

Introduce a `plistComment` property on `PBXFileSystemSynchronizedExceptionSet` (base, returns ISA) and override it in subclasses to produce Xcode 26.3's format: `Exceptions for "<folder>" folder in "<target>" target`.

The back-reference to the owning root group is established via an `assignParentToChildren()` override, consistent with how `PBXFileElement.parent` is wired up for the group hierarchy.

Made-with: Cursor
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 12, 2026
@macguru macguru changed the title Xcode 26.3 format updates feat: Xcode 26.3 format updates Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant