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-12101] swiftpm master vs. 5.2 dependency state mismatch #4616

Closed
benlangmuir opened this issue Jan 28, 2020 · 4 comments
Closed

[SR-12101] swiftpm master vs. 5.2 dependency state mismatch #4616

benlangmuir opened this issue Jan 28, 2020 · 4 comments
Assignees
Labels

Comments

@benlangmuir
Copy link
Member

Previous ID SR-12101
Radar None
Original Reporter @benlangmuir
Type Bug
Status Resolved
Resolution Done
Environment

libSwiftPM: master @ f9cf27e
swift-package CLI: swift-5.2

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @hartbit
Priority Medium

md5: 5801698576b30e2efd92f7293bbb62db

Issue Description:

Using swift-5.2, I put a package in edit mode.

git clone git@github.com:apple/sourcekit-lsp.git
git clone git@github.com:apple/indexstore-db.git
cd sourcekit-lsp
swift package edit IndexStoreDB --path ../indexstore-db

This creates a dependencies-state.json file that contains

"state" : {
   "path" : "/Users/blangmuir/src/lsp/indexstore-db",
   "name" : "edited"
},

Now try using swiftpm from a recent master toolchain, which unexpectedly updates all the repos and takes indexstore-db out of edited state:

TOOLCHAINS="org.swift.50202001271a" swift build
Updating https://github.com/apple/swift-llbuild.git
Updating https://github.com/apple/swift-package-manager.git
Updating https://github.com/apple/indexstore-db.git
Updating https://github.com/apple/swift-tools-support-core.git
Cloning https://github.com/apple/indexstore-db.git
Resolving https://github.com/apple/indexstore-db.git at master
Cloning https://github.com/apple/swift-package-manager.git
Resolving https://github.com/apple/swift-package-manager.git at master
Cloning https://github.com/apple/swift-llbuild.git
Resolving https://github.com/apple/swift-llbuild.git at master
Cloning https://github.com/apple/swift-tools-support-core.git
Resolving https://github.com/apple/swift-tools-support-core.git at master

This removes dependencies-state.json and replaces it with workspace-state.json, and now it is no longer in edited state:

"state" : {
   "checkoutState" : {
      "branch" : "master",
      "revision" : "330aada8e7b815121ad838dec0a825d2a9cb5ecc",
      "version" : null
   },
   "name" : "checkout"
}
@ankitspd
Copy link
Member

cc @hartbit

@benlangmuir
Copy link
Member Author

Here is how sourcekit-lsp is setting up the Workspace in libSwiftPM in case we're holding it wrong: https://github.com/apple/sourcekit-lsp/blob/d62be20b75180cedd0e92df9f76e3d00a329cbc2/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift#L85

@benlangmuir
Copy link
Member Author

Update: I was able to reproduce from just the command-line swiftpm tools. Updated description to describe the reproduction steps.

@hartbit
Copy link
Collaborator

hartbit commented Jan 29, 2020

Resolved in #2542
The issue also exists between Swift 5.1 and 5.2, so I also opened a PR against 5.2: #2543

@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

3 participants