fix(cli): support Xcode's JSON project format (project.xcproj) - #8608
Open
erkamyaman wants to merge 1 commit into
Open
erkamyaman wants to merge 1 commit into
erkamyaman wants to merge 1 commit into
Conversation
erkamyaman
marked this pull request as draft
September 16, 2026 22:43
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.
Fixes #8607
Xcode 27.2 can store a project as
App.xcodeproj/project.xcproj(JSON with trailing commas) instead ofproject.pbxproj. The CLI readproject.pbxprojunconditionally, so after converting a project,cap sync iosfailed to rewriteCapApp-SPM/Package.swiftwhile still exiting 0. Added and removed plugins then never reached iOS, and removing one broke the Xcode build.Changes
getXcodeProjectFile()returnsproject.pbxproj, orproject.xcprojwhen that's the only file present. Projects that haveproject.pbxprojtake exactly the same code paths as before.project.xcproj, build settings are matched as"KEY": "value", including per-configuration keys such as"IPHONEOS_DEPLOYMENT_TARGET[config=Release]", which Xcode writes when Debug and Release differ.getMajoriOSVersion()(used when generatingPackage.swiftand bycap updateandcap migrate) returns the lowest deployment target in the file.cap migratesets every deployment target through the newsetXcprojDeploymentTarget().editProjectSettingsIOS()setsPRODUCT_BUNDLE_IDENTIFIER. Each file format only gets its own pattern.SceneDelegate.swiftin aproject.xcproj, because thexcodepackage only parses.pbxproj. It now says so and asks for the file to be added in Xcode, or skips if the file is already listed.Not covered
Package.swiftis still logged without failingcap sync. This PR removes the cause forproject.xcprojprojects but doesn't change that error handling.determineIOSWebDirAbs()still only looks atproject.pbxproj, which only matters for the deprecated layout withpublicat the iOS project root.project.xcproj, sopod installfails on converted CocoaPods projects. That's outside the CLI.nexthas the same code, so this will need to reach it too.Testing
cli/test/ios-project-file.spec.ts. Its two fixtures were generated fromios-spm-templatewithxcodebuild -convert-project "Xcode Project"(Xcode 27.2 beta, 27B5019j): one as shipped, and one with a 16.0 Release deployment target, which produces the per-configuration keys. The tests cover choosing the file, reading the deployment target (including per configuration), setting every deployment target, and setting the bundle ID in both formats while leaving the rest ofproject.xcprojbyte-identical.npm testincli: 13 suites, 92 tests pass. ESLint and Prettier pass on the changed files.project.pbxproj):cap sync iosandcap update iosproduce byte-identicalios/output with this change and with 8.5.2.@capacitor/appand syncing drops it fromPackage.swift, and adding it back restores it. Both syncs run without errors, and the app builds after each.cap sync ioswritesplatforms: [.iOS(.v15)], and the app builds.cap migrate --packagemanager npmon that project, after setting the targets to 14.0 and 13.0: all four deployment target keys become 15.0, and the app builds.