Search code examples
swift-package-manager

Force Swift Package Manager to honour Package.resolved


I am trying to use Swift Package manager to update my dependencies locally to match those in the Package.resolved file.

For example, when I update my dependencies I run swift package update, which updates the Package.resolved file, which I then commit. When I pull this new commit on to a computer that has an existing .build directory with the old versions of the dependencies I would like to update the local versions to the one in Package.resolved.

I was expecting swift package resolve to do this, but instead it updates the Package.resolved according to the .build/dependencies-state.json.

The obvious solution is to delete the .build directory, but this means the dependencies are recompiled every time, which can be slow on CI.

I want the equivalent of bundle install, yarn install, or carthage boostrap. Is this possible?


Solution

  • This has been confirmed to be a bug, and I have opened a bug in the Swift JIRA.