Skip to content

Add .xcworkspace support to Xcode build system#36

Merged
obj-p merged 2 commits intomainfrom
xcworkspace-support
Mar 21, 2026
Merged

Add .xcworkspace support to Xcode build system#36
obj-p merged 2 commits intomainfrom
xcworkspace-support

Conversation

@obj-p
Copy link
Copy Markdown
Owner

@obj-p obj-p commented Mar 21, 2026

Summary

Closes #34. Extends XcodeBuildSystem to detect and build with .xcworkspace files, preferring them over .xcodeproj when both exist (standard Xcode convention).

  • Rename xcodeproj property to projectFile, derive -workspace/-project flag from extension
  • Simplify ProjectInfo to decode both project and workspace JSON from xcodebuild -list
  • Add findXcodeProject() that prefers .xcworkspace over .xcodeproj
  • Add examples/xcworkspace/ example project with workspace wrapping XcodeGen-generated project
  • Update MCP projectPath description to mention Xcode projects
  • Add swift-format and GitHub MCP permissions to .claude/settings.json

Test plan

  • swift build passes
  • swift test --filter BuildSystem — all 35 tests pass, including new:
    • findXcodeProjectFindsWorkspace — workspace-only directory
    • findXcodeProjectPrefersWorkspace — both exist, workspace wins
    • decodeProjectInfoFromProjectJSON — project JSON format
    • decodeProjectInfoFromWorkspaceJSON — workspace JSON format
  • Integration test: preview_start on examples/xcworkspace/ with projectPath detects workspace and renders

🤖 Generated with Claude Code

obj-p and others added 2 commits March 21, 2026 13:24
Extend XcodeBuildSystem to detect and build with .xcworkspace files,
preferring them over .xcodeproj when both exist (standard Xcode convention).

- Rename xcodeproj property to projectFile, derive -workspace/-project flag from extension
- Simplify ProjectInfo to decode both project and workspace JSON from xcodebuild -list
- Add findXcodeProject() that prefers .xcworkspace over .xcodeproj
- Add xcworkspace example project with workspace wrapping XcodeGen-generated project
- Update MCP projectPath description to mention Xcode projects
- Add swift-format and GitHub MCP permissions to .claude/settings.json

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…decoder error

- findXcodeProject now prefers a workspace whose stem matches a colocated
  .xcodeproj, avoiding auxiliary workspaces (e.g., Pods.xcworkspace)
- ProjectInfo decoder explicitly checks for both keys and throws a clear
  dataCorrupted error when neither project nor workspace key is present
- Add tests: stem-matching preference, invalid JSON decoder error

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@obj-p obj-p merged commit 583817d into main Mar 21, 2026
2 checks passed
@obj-p obj-p deleted the xcworkspace-support branch March 21, 2026 17:52
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.

Xcode workspace (.xcworkspace) build system support

1 participant