Uploaded image for project: 'Swift'
  1. Swift
  2. SR-14393

SPM package repo URL conflicts fail resolution

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Package Manager
    • Labels:
      None
    • Environment:

      Xcode 12.4

      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:

      And then downstream, where the URL included ".git": https://github.com/pointfreeco/isowords/blob/2db490517a7768cd8d82807eabb33bf7ae1418ce/Package.swift#L42

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            stephencelis Stephen Celis
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: