[SR-10718] swift package resolve
overwrites Package.resolved
when Package.resolved
has newer version of existing dependency
#4709
Labels
Attachment: Download
Environment
$ swift --version
Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.6.0
Additional Detail from JIRA
md5: e26f4278803c91cbf0f46baa651a29cc
Issue Description:
Following on from the discussion on https://forums.swift.org/t/how-to-update-local-dependencies-to-match-package-resolved/24686, this bug is around how the
swift package resolve
command works.When a new version of the
Package.resolved
file is pulled andswift package resolve
is run it will overwrite thePackage.resolved
file with the currently installed versions – presumably from the.build/dependencies-state.json
file – rather than checkout the versions of the dependencies inPackage.resolved
.Attached is .zip containing a basic setup that demonstrates this issue, including a README for how to use the project to reproduce the issue.
The steps to reproduce that this is faking are:
No
.build
directory,from: "1.0.0"
inPackage.swift
swift build
I now version 1.0.0 compiled in the
.build
directory and 1.0.0 inPackage.resolved
Dependency releases 1.1.0
Run
swift package update
on another computer, commit and push change toPackage.resolved
Pull the commit that updates
Package.resolved
to have version 1.1.0swift package resolve
Package.resolved
now has 1.0.0 in it, essentially reverting the pulled commitAt this point I would expect version 1.1.0 to be checked out and no change to the
Package.resolved
file.The text was updated successfully, but these errors were encountered: