swiftxcodecontinuous-integrationswift-package-manager

How to trigger Xcode's 'Update to Latest Package Versions' from command line?


Goal:

I want to programmatically update the versions of Swift Packages consumed by a sample project.

Problem:

Xcode > 11 offers a menu option:

File > Swift Packages > Update to Latest Package Versions

This will update the Package.resolved file to point to a specific revision.

This file is located at:

MyProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

How can I trigger this action from the command line for a CI build?


Solution

  • Wound up abandoning this route since ideally CI tests what GOING to be in the repo instead of what IS in the repo.

    End solution wound up being to point to a dummy branch and then force push the CI-generated merge commit to that branch.

    It's a little hacky but gives accurate feedback on how the package will be consumed post-merge.

    Update: Was able to find a way better solution. https://stackoverflow.com/a/61110638/2565025