Open bcardarella opened 9 months ago
If I read this correctly, I would expect this to fail since 0.3.0-alpha.3 is considered to be > 0.2.0
The error message is very poor, though.
@neonichu but the version constraint is from: 0.2.0
Ah, sorry, I somehow misread this. You're correct that this allows any version up to but not including 1.0.0.
There may be a quirk here with prerelease identifiers?
That's what I was thinking. Our versioning is valid Semantic Versioning: 0.3.0-alpha.3
While I'm at it, I think there is a bug that SwiftPM doesn't accept the form v0.3.0-alpha.3
as that is also valid formatting per semver's spec
We've recently encountered the same problem. The official SPM docs (in code and online) both support SemVer 2.0, even linking the website and paragraph 11.
However, prerelease extensions do not work for SPM when you have a dependency on an exact pre-release version alongside a dependency that depends on "from" a lower version of that same package.
As far as I understand SemVer and from what I've seen in other package managers this should work. However, it does not work in either a standalone SPM Package or an Xcode project, with Xcode 15.2, 15.3, or 15.4.
This is the minimal reproduction Package.swift
I can provide for this:
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "SPMSemVerReproPackage",
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "SPMSemVerReproPackage",
targets: ["SPMSemVerReproPackage"]),
],
dependencies: [
.package(url: "https://github.com/getditto/DittoSwiftPackage", exact: "4.7.2-rc.3"),
.package(url: "https://github.com/getditto/DittoSwiftTools", from: "4.11.0"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "SPMSemVerReproPackage"),
.testTarget(
name: "SPMSemVerReproPackageTests",
dependencies: ["SPMSemVerReproPackage"]),
]
)
Which results in the this error during package resolution:
Showing All Issues
Failed to resolve dependencies Dependencies could not be resolved because root depends on 'dittoswiftpackage' 4.7.2-rc.3 and root depends on 'dittoswifttools' 4.11.0..<5.0.0.
'dittoswifttools' >= 4.11.0 practically depends on 'dittoswiftpackage' 4.5.0..<5.0.0 because no versions of 'dittoswifttools' match the requirement 4.11.1..<5.0.0 and 'dittoswifttools' 4.11.0 depends on 'dittoswiftpackage' 4.5.0..<5.0.0.
Description
I am seeing what I believe is unintended behavior for dependency resolution with SwiftPM
I have two libraries that are tagged as pre-release:
the Mapkit lib depends on the SwiftUI client lib.
the SwiftUI client was installed with
Exact Version: 0.3.0-alpha.3
this installs OK.
The Mapkit lib has a dependency of
liveview-client-swiftui from: 0.2.0
which should be valid for every version from0.2.0
-1.0.0
Expected behavior
I would expect the Mapkit lib to install OK because it's Package.swift file has a dependency rule for liveview-client-swiftui for a range of versions that the installed version is within
Actual behavior
Installation of the Mapkit lib fails with this error:
Steps to reproduce
No response
Swift Package Manager version/commit hash
Xcode 15.2
Swift & OS version (output of
swift --version ; uname -a
)Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) Target: arm64-apple-darwin23.2.0 Darwin Brians-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112 arm64