Description
Previous ID | SR-14393 |
Radar | rdar://problem/75743990 |
Original Reporter | @stephencelis |
Type | Bug |
Environment
Xcode 12.4
Additional Detail from JIRA
Votes | 1 |
Component/s | Package Manager |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 1a056f06c807d89b50a4a494f3285c84
Issue Description:
Following from discussion here: https://forums.swift.org/t/package-url-conflicts/35915/9
If the same package is depended on twice in a project, for example in an upstream dependency as well as downstream, and the URL is slightly different, for example, upstream omits the ".git" of a GitHub package, and downstream includes it, then package resolution sometimes seems to omit this dependency entirely, leading to confusing "Missing package product" errors.
Ideally:
-
SPM would use the SHA/version information of the resolved packages even if the URLs are different and the user would not encounter any error, or
-
SPM would "canonicalize" common URL differences like these into a single representation, or
-
SPM would at least provide an error message that points to the mismatch
Pasted from the discussion for more context:
I've hit this a few times. Luckily in repos I'm an owner of so I can fix, but always more painful to debug and track down than I expect given the error messaging. The bug does appear to be non-deterministic, but here's an open source project that exhibits the issue on CI, and I was able to reproduce it:
https://github.com/pointfreeco/isowords/runs/2175855054?check_suite_focus=true
The error is "Missing package product 'XCTestDynamicOverlay'", which comes from a package that is depended on both upstream in several libraries, where ".git" is omitted from the repo name:
-
combine-schedulers: https://github.com/pointfreeco/combine-schedulers/blob/f1250faa1c1436ca83950ce676a4fe97a309a457/Package.swift#L20)
-
swift-composable-architecture: https://github.com/pointfreeco/swift-composable-architecture/blob/b3b913462e8ca01651861dd4cef2e677ffc44223/Package.swift#L22
And then downstream, where the URL included ".git": https://github.com/pointfreeco/isowords/blob/2db490517a7768cd8d82807eabb33bf7ae1418ce/Package.swift#L42