Skip to content

Xcode workspace (.xcworkspace) build system support #34

@obj-p

Description

@obj-p

Summary

Add .xcworkspace support to XcodeBuildSystem, extending the existing .xcodeproj support added in #16.

Motivation

Xcode workspaces are the standard way to manage multi-project setups:

  • CocoaPods projects (Pods.xcodeproj + App.xcodeproj wrapped in a workspace)
  • SPM-integrated Xcode projects (Xcode auto-generates a workspace)
  • Multi-project apps (e.g., app + frameworks + extensions)

When a .xcworkspace exists alongside a .xcodeproj, Xcode itself prefers the workspace. PreviewsMCP should do the same.

Proposed Changes

  1. Detection: In XcodeBuildSystem.detect(for:), check for .xcworkspace before .xcodeproj. If both exist, prefer the workspace.

  2. Build commands: Use -workspace <path> -scheme <scheme> instead of -project <path> -scheme <scheme>. The rest of the pipeline (build settings parsing, OutputFileMap, -F flags) is identical.

  3. Scheme discovery: xcodebuild -workspace <path> -list -json works the same as -project.

Non-Goals

  • No need to parse workspace contents (.xcworkspacedata) — xcodebuild handles project resolution internally
  • No CocoaPods-specific logic — the workspace abstraction handles this transparently

Context

.xcodeproj support was added in #16/#32. The current XcodeBuildSystem stores an xcodeproj: URL — this would become a more general projectOrWorkspace: URL with a flag or enum indicating which xcodebuild flag to use (-project vs -workspace).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions