豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

feat: add .xcworkspace support for xcode swiftpm#14459

Merged
AbhishekBhaskar merged 20 commits intomainfrom
swift-xcworkspace-on-14394
Mar 18, 2026
Merged

feat: add .xcworkspace support for xcode swiftpm#14459
AbhishekBhaskar merged 20 commits intomainfrom
swift-xcworkspace-on-14394

Conversation

@markhallen
Copy link
Copy Markdown
Contributor

What are you trying to accomplish?

Add support for Xcode SwiftPM projects that store Package.resolved in .xcworkspace bundles, while keeping existing .xcodeproj behavior intact.

This is a stacked follow-up to:

Related issue:

Anything you want to highlight for special attention from reviewers?

This PR is intentionally scoped to the minimum delta on top of #14394:

  • Extend FileFetcher discovery to include .xcworkspace bundles (including nested directories), and fetch:
    • *.xcworkspace/contents.xcworkspacedata as support files
    • *.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • Treat workspace lockfiles as Xcode SPM inputs in parser/update-checker/updater paths.
  • Make resolver/updater matching workspace-aware so dependencies declared in sibling .xcodeproj/project.pbxproj can map to workspace-level Package.resolved.
  • Add fixtures/specs for:
    • workspace-only layout
    • nested workspace layout
    • parser enrichment in workspace mode
    • updater lockfile matching for workspace scope

I avoided linking any dependabot-updates issues in this PR body.

How will you know you've accomplished your goal?

Validation run in container:

  • bin/test swift rubocop
  • bin/test swift spec/dependabot/swift/file_fetcher_spec.rb spec/dependabot/swift/file_parser/xcode_spm_resolver_spec.rb spec/dependabot/swift/file_updater/xcode_lockfile_updater_spec.rb spec/dependabot/swift/file_updater_spec.rb

Both commands pass on this branch.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@markhallen markhallen requested a review from a team as a code owner March 16, 2026 12:39
@github-actions github-actions bot added the L: swift Swift packages label Mar 16, 2026
Base automatically changed from swift-xcode-spm-file-updater to main March 16, 2026 17:43
Copilot AI review requested due to automatic review settings March 17, 2026 06:04
Comment thread swift/lib/dependabot/swift/xcode_file_helpers.rb Fixed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Swift ecosystem support for Xcode SwiftPM projects where Package.resolved is stored at the .xcworkspace scope (including nested workspaces), while preserving existing .xcodeproj behavior.

Changes:

  • Extend Swift FileFetcher discovery to find .xcworkspace bundles recursively and fetch workspace contents.xcworkspacedata + workspace Package.resolved.
  • Treat workspace-scoped Package.resolved as valid Xcode SPM inputs across parser/update-checker/updater flows via shared XcodeFileHelpers.
  • Make Xcode lockfile updating scope-aware for workspace lockfiles by mapping sibling .xcodeproj requirements into the workspace scope (with accompanying fixtures/specs).

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
swift/lib/dependabot/swift/file_fetcher.rb Recursively discovers .xcodeproj and .xcworkspace directories; fetches workspace support/lockfiles.
swift/lib/dependabot/swift/file_parser.rb Broadens Xcode lockfile selection to include .xcworkspace paths via XcodeFileHelpers.
swift/lib/dependabot/swift/file_parser/xcode_spm_resolver.rb Updates enrichment logic to be workspace-aware when selecting pbxproj requirements.
swift/lib/dependabot/swift/file_updater.rb Passes workspace support files into the Xcode lockfile updater; includes workspace lockfiles in selection.
swift/lib/dependabot/swift/file_updater/xcode_lockfile_updater.rb Adds workspace-aware scope matching and uses workspace contents.xcworkspacedata to relate sibling projects.
swift/lib/dependabot/swift/update_checker.rb Includes .xcworkspace-scoped resolved files in Xcode SPM mode selection.
swift/lib/dependabot/swift/xcode_file_helpers.rb New shared helper for identifying Xcode resolved paths and extracting Xcode scope dirs.
swift/spec/dependabot/swift/file_fetcher_spec.rb Adds coverage for fetching workspace-scoped files and nested workspace discovery.
swift/spec/dependabot/swift/file_parser/xcode_spm_resolver_spec.rb Adds coverage for workspace-scoped lockfile parsing/enrichment behavior.
swift/spec/dependabot/swift/file_updater/xcode_lockfile_updater_spec.rb Adds coverage for workspace-scoped lockfile matching against sibling project requirements.
swift/spec/dependabot/swift/file_updater_spec.rb Adds end-to-end updater coverage for updating a workspace-scoped Package.resolved.
swift/spec/fixtures/projects/xcode_workspace/MyApp.xcworkspace/contents.xcworkspacedata Workspace fixture for .xcworkspace support file.
swift/spec/fixtures/projects/xcode_workspace/MyApp.xcworkspace/xcshareddata/swiftpm/Package.resolved Workspace-scoped Package.resolved fixture.
swift/spec/fixtures/projects/xcode_workspace/AppA.xcodeproj/project.pbxproj Sibling project fixture providing dependency requirements.
swift/spec/fixtures/projects/xcode_workspace/AppA.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Project-scoped Package.resolved fixture (existing Xcodeproj behavior).
swift/spec/fixtures/projects/xcode_workspace_nested/ios/MyApp.xcworkspace/contents.xcworkspacedata Nested workspace fixture for recursive discovery.
swift/spec/fixtures/projects/xcode_workspace_nested/ios/MyApp.xcworkspace/xcshareddata/swiftpm/Package.resolved Nested workspace-scoped Package.resolved fixture.
swift/spec/fixtures/projects/xcode_workspace_nested/ios/AppA.xcodeproj/project.pbxproj Nested sibling project requirements fixture.
swift/spec/fixtures/projects/xcode_workspace_nested/ios/AppA.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Nested project-scoped Package.resolved fixture.
Files not reviewed (2)
  • swift/spec/fixtures/projects/xcode_workspace/MyApp.xcworkspace/contents.xcworkspacedata: Language not supported
  • swift/spec/fixtures/projects/xcode_workspace_nested/ios/MyApp.xcworkspace/contents.xcworkspacedata: Language not supported

You can also share your feedback on Copilot code review. Take the survey.

Comment thread swift/lib/dependabot/swift/file_parser.rb Outdated
Comment thread swift/lib/dependabot/swift/file_parser/xcode_spm_resolver.rb
Comment thread swift/lib/dependabot/swift/file_fetcher.rb
AbhishekBhaskar and others added 5 commits March 17, 2026 12:57
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@AbhishekBhaskar AbhishekBhaskar merged commit f5cdbe1 into main Mar 18, 2026
84 checks passed
@AbhishekBhaskar AbhishekBhaskar deleted the swift-xcworkspace-on-14394 branch March 18, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: swift Swift packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants