From 7d30401668b7a0de9f6d06a8e3b0afb2e8dbd633 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 30 Sep 2026 15:32:04 +0300 Subject: [PATCH] fix: serialize schemes the way Xcode does Xcode rewrites schemes generated by XcodeProj as soon as it touches them, which shows up as noise in projects that commit generated schemes. Match Xcode's own output: - Write `TestPlans` as the last child of `TestAction`. - Omit an empty `Testables` element when the scheme uses test plans. - Omit empty `CommandLineArguments` elements. - Only write `runPostActionsOnFailure` when it is enabled. - Write `TestPlanReference` attributes in Xcode's order (`reference`, then `default`). Verified against a scheme re-saved by Xcode 27: regenerating it with these changes produces a byte-identical file. --- .../xcshareddata/xcschemes/iOS.xcscheme | 12 +++---- .../Extensions/AEXML+XcodeFormat.swift | 4 +++ .../Scheme/XCScheme+BuildAction.swift | 5 +-- .../Scheme/XCScheme+LaunchAction.swift | 2 +- .../Scheme/XCScheme+ProfileAction.swift | 2 +- .../Scheme/XCScheme+TestAction.swift | 25 ++++++++------- .../XcodeProjTests/Scheme/XCSchemeTests.swift | 31 +++++++++++++++++++ 7 files changed, 60 insertions(+), 21 deletions(-) diff --git a/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme b/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme index 5ec735651..1b4bc284c 100644 --- a/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme +++ b/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme @@ -81,12 +81,6 @@ - - - - + + + +