Add support for Xcode 27.2's JSON project format - #1653
Open
antigluten wants to merge 1 commit into
Open
antigluten wants to merge 1 commit into
antigluten wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
options.projectFormat: json, which writesproject.xcprojinstead ofproject.pbxprojXcode 27.2 stores a project as JSON in
project.xcprojby default, a format Apple documents and implements in apple/xcode-project-format. XcodeProj shipped an experimental writer for it in 9.17.0. This exposes it as one moreprojectFormatvalue rather than a separate option, which is how Xcode 27.2 presents it too: JSON is an entry in the same Project Format pop-up as the object version choices.The default is unchanged, and nothing differs for anyone who does not opt in.
The requirements bump
XcodeProj 9.17 depends on
apple/xcode-project-format, which needs Swift 6.1 and macOS 14, so XcodeGen now needs the same. SwiftPM has no conditional form for this:platforms:is one static declaration per package, and a build with.macOS(.v11)fails withrequires minimum platform version 14.0 for the macOS platform. The only alternative was staying on XcodeProj 9.16 and not having the format at all. This is the real cost of the PR and the part most worth pushing back on.Two things that do not work yet
Against XcodeProj 9.17.1, two spec shapes generate a project Xcode will not open. Both are fixed upstream and unreleased, and both are called out in the docs:
copyFilestarget source (tuist/XcodeProj#1181)A third upstream bug would have made every regeneration a diff: XcodeProj settles its deterministic object identifiers only while encoding the property list, so the JSON writer emitted a fresh
TEMP_<UUID>per run (tuist/XcodeProj#1180). That one is worked around inFileWriterby encoding a property list and discarding it, with a comment saying to drop the workaround once the fix ships.One unrelated fix
XcodeProj 9.16 added a
hostBuildToolproduct type, which broke the exhaustive switch inTarget.defaultLinkage. It is handled alongside the other executable product types.Test plan
swift test, all greenscripts/gen-fixtures.shfollowed byscripts/diff-fixtures.sh: generated fixtures are unchanged, so the XcodeProj bump alters no existing outputProjectGeneratorTests.testProjectFormat: the default still writesproject.pbxproj,jsonwritesproject.xcprojand reads back as.xcproj, two generations produce byte-identical output, and switching format deletes the file the previous one left behindprojectFormat: jsonand confirmedxcodebuild -listreads it, using Xcode 27.0