Extend Swift file updater to support xcode swiftpm dependency update#14394
Merged
Conversation
…ft-xcode-spm-file-updater
…t/dependabot-core into swift-xcode-spm-file-updater
Contributor
There was a problem hiding this comment.
Pull request overview
Adds experimental support in the Swift ecosystem for updating Xcode-managed SwiftPM projects that only contain .xcodeproj files (no Package.swift) by editing Xcode Package.resolved files in-place, enabling Dependabot PRs for these repos.
Changes:
- Introduces an Xcode-specific
Package.resolvedupdater that preserves schema versions (v1/v2/v3) and formatting. - Adds
xcode_spm_mode?branching in the SwiftFileUpdaterto update Xcode lockfiles without invoking the Swift CLI. - Improves Swift
UpdateCheckerandMetadataFinderhandling for revision/branch pins and dependencies without explicit source type.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| swift/spec/dependabot/swift/file_updater_spec.rb | Adds integration coverage for Xcode SPM mode updating the correct Package.resolved file(s). |
| swift/spec/dependabot/swift/file_updater/xcode_lockfile_updater_spec.rb | Adds unit tests for updating v1/v2/v3 resolved schemas and error cases. |
| swift/lib/dependabot/swift/update_checker.rb | Avoids T.must on nil preferred_resolvable_version for revision/branch-pinned deps. |
| swift/lib/dependabot/swift/metadata_finder.rb | Infers source from dependency name when source_type is default/nil. |
| swift/lib/dependabot/swift/file_updater/xcode_lockfile_updater.rb | Implements in-place JSON update logic for Xcode Package.resolved. |
| swift/lib/dependabot/swift/file_updater.rb | Adds experiment-gated Xcode mode and updates required-files logic accordingly. |
You can also share your feedback on Copilot code review. Take the survey.
5 tasks
markhallen
previously approved these changes
Mar 16, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
robaiken
approved these changes
Mar 16, 2026
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.
What are you trying to accomplish?
This PR adds support for updating
Package.resolvedfiles in Xcode-managed SwiftPM projects that don't have aPackage.swiftmanifest, enabling Dependabot to generate dependency update PRs for.xcodeproj-only Swift projects.Changes:
New file:
swift/lib/dependabot/swift/file_updater/xcode_lockfile_updater.rbPackage.resolvedfiles in-place without running Swift CLIModified:
file_updater.rbxcode_spm_mode?detection when experiment is enabled and no Package.swift existscheck_required_filesto accept XcodePackage.resolvedfilesModified:
[update_checker.rbpreferred_resolvable_versionfor revision-only or branch-pinned dependenciesModified:
metadata_finder.rbAnything you want to highlight for special attention from reviewers?
Behaviour:
Package.resolvedfiles with minimal changesHow will you know you've accomplished your goal?
Checklist