swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.71k stars 1.33k forks source link

[SR-5693] SemVer variant incompatible with SwiftPM #4966

Open BasThomas opened 7 years ago

BasThomas commented 7 years ago
Previous ID SR-5693
Radar rdar://problem/40205279
Original Reporter @BasThomas
Type Bug
Environment Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42) Target: x86_64-apple-macosx10.9 /Library/Developer/CommandLineTools/usr/bin/lldb "--repl=-enable-objc-interop -sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -color-diagnostics" Welcome to Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42).
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 8fa4044d8e9412f2d3bde2d32cebba5f

Issue Description:

Although a version like 9.0.0-alpha.1 is compatible with SemVer, it is not supported in SwiftPM, which errors with "unsatisfiable". More information can be found in this issue over at Moya.

aciidgh commented 7 years ago

unsatisfiable means that the resolver was not able to find a valid solution. The dependency resolution around prerelease tags in Swift 3 toolchain is broken. Can you try the same thing with a swift 4 toolchain? You don't need to update the manifest, just the toolchain.

If that also fails, can you also post the exact manifest you're having problems with?

Thanks!

BasThomas commented 7 years ago

If I can find the time I'd gladly test with the Swift 4 toolchain. In the meantime, it seems like the specific issue was actually a git bug, wherein the tag name and branch name are the same, causing the resolver to fail. I'd guess we can close the issue then.

If this is something that can be resolved via SwiftPM, that would be awesome. If not, improving the error messaging (again, if possible) would be another improvement.

Thanks for the update, Ankit!

aciidgh commented 6 years ago

@swift-ci create

krzyzanowskim commented 1 year ago

It's been almost 5 years now since it's broken, I wonder whether SwiftPM documentation at https://www.swift.org/package-manager/ should still state that it follows SemVer, while it's not. wdyt?

WowbaggersLiquidLunch commented 1 year ago

The version string "9.0.0-alpha.1" in the original bug report should be parsed correctly since #3486 and apple/swift-tools-support-core#214. There are still some bugs in the parsing logic that deviates form SemVer's (but I forgot what exactly). Last year I had planned to first fix DocC SymbolKit's SemVer implementation apple/swift-docc-symbolkit#36, then carry the same change into DocC's, then adapt it to fix SwiftPM/TSC's. I just haven't gotten around to it yet. (Maybe I can pick it up this weekend or next week, but no promises)

krzyzanowskim commented 1 year ago

thanks!

btw. I just tried "2.0-beta.1" and "2.0.0-beta.1" and it didn't work in Xcode SwiftPM

WowbaggersLiquidLunch commented 1 year ago

Are you using the version string in an Xcode project or a Swift package? If it's the former, then I guess the bug might be because Xcode doesn't use SwiftPM/TSC's version parser, as discovered by @SDGGiesbrecht in #6143.

tomerd commented 1 year ago

cc @abertelrud if this is an Xcode specific issue, lets track it as such.