Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-10718] swift package resolve overwrites Package.resolved when Package.resolved has newer version of existing dependency #4709

Closed
JosephDuffy opened this issue May 20, 2019 · 7 comments
Labels

Comments

@JosephDuffy
Copy link

Previous ID SR-10718
Radar rdar://problem/51080676
Original Reporter @JosephDuffy
Type Bug
Status Resolved
Resolution Done

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
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

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 and swift package resolve is run it will overwrite the Package.resolved file with the currently installed versions – presumably from the .build/dependencies-state.json file – rather than checkout the versions of the dependencies in Package.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:

  1. No .build directory, from: "1.0.0" in Package.swift

  2. swift build

  3. I now version 1.0.0 compiled in the .build directory and 1.0.0 in Package.resolved

  4. Dependency releases 1.1.0

  5. Run swift package update on another computer, commit and push change to Package.resolved

  6. Pull the commit that updates Package.resolved to have version 1.1.0

  7. swift package resolve

  8. Package.resolved now has 1.0.0 in it, essentially reverting the pulled commit

At this point I would expect version 1.1.0 to be checked out and no change to the Package.resolved file.

@ankitspd
Copy link
Member

#2230 master

#2229 swift-5.1-branch

@ankitspd
Copy link
Member

Had to revert this because it caused SR-11135

master #2239
5.1 #2240

@ankitspd
Copy link
Member

ankitspd commented Feb 6, 2020

Can you check with trunk snapshots as we've had a lot of improvements in this area.

@JosephDuffy
Copy link
Author

I've tried this with the Swift version shipped with Xcode 11.4 beta 1 and it appears to be fixed, thanks!

@CraigSiemens
Copy link

This issue is occurring again in Xcode 12.3. Steps to reproduce are the exact same.

@danieleformichelli
Copy link

I have created a new issue as I still see this on Xcode 13: https://bugs.swift.org/browse/SR-15359

@CraigSiemens
Copy link

I had filed an issue for this as well https://bugs.swift.org/browse/SR-14647

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants