You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix registry resolution of major alternate package manifests (#8188)
### Motivation:
Let's take the following `Package.swift`:
```swift
// swift-tools-version: 5.7
import PackageDescription
let package = Package(
name: "Library",
dependencies: [
.package(id: "AliSoftware.OHHTTPStubs", exact: "9.0.0")
]
)
```
You can find the `OHHTTPStubs` dependency at that version
[here](https://github.com/AliSoftware/OHHTTPStubs/tree/e92b5a5746ef16add2a1424f1fc19529d9a75cde).
The dependency has two manifests:
- `Package.swift` with `swift-tools-version` at `4.0`
- `[email protected]` with `swift-tools-version` at `5.0`
When resolving packages via the registry, SwiftPM should use the
`[email protected]`. However, instead SwiftPM fails with:
```
Running resolver because the following dependencies were added: 'AliSoftware.OHHTTPStubs' (AliSoftware.OHHTTPStubs)
Computing version for AliSoftware.OHHTTPStubs
info: 'AliSoftware.OHHTTPStubs': retrieving AliSoftware.OHHTTPStubs metadata from http://localhost:8080/api/accounts/tuist/registry/swift/AliSoftware/OHHTTPStubs
info: 'AliSoftware.OHHTTPStubs': retrieving AliSoftware.OHHTTPStubs 9.0.0 metadata from http://localhost:8080/api/accounts/tuist/registry/swift/AliSoftware/OHHTTPStubs/9.0.0
info: 'AliSoftware.OHHTTPStubs': retrieving available manifests for AliSoftware.OHHTTPStubs 9.0.0 from http://localhost:8080/api/accounts/tuist/registry/swift/AliSoftware/OHHTTPStubs/9.0.0/Package.swift
info: 'AliSoftware.OHHTTPStubs': retrieving AliSoftware.OHHTTPStubs 9.0.0 metadata from http://localhost:8080/api/accounts/tuist/registry/swift/AliSoftware/OHHTTPStubs/9.0.0
info: 'AliSoftware.OHHTTPStubs': retrieving AliSoftware.OHHTTPStubs 9.0.0 manifest from http://localhost:8080/api/accounts/tuist/registry/swift/AliSoftware/OHHTTPStubs/9.0.0/Package.swift?swift-version=5.0.0
error: failed locating placeholder manifest for 5.0.0
```
### Modifications:
The reason for the error is because when looking up the alternate
package manifests from the downloaded source archive, SwiftPM doesn't
try to find `[email protected]` – only `[email protected]` and
`[email protected]`.
When both minor and patch versions of the swift tools version are 0,
SwiftPM should try to use the `[email protected]` alternate
manifest.
### Result:
`swift package resolve` will work for packages in a registry that have
alternate manifests in the format of `[email protected]`.
0 commit comments