'X' dependency on 'https://github.com/Y.git' conflicts with dependency on 'https://github.com/Z' which has the same identity 'swift-protobuf'. this will be escalated to an error in future versions of SwiftPM

I have a project which includes a local package. That local package has a dependency on a fork of SwiftProtobuf.
I also included Firebase as a dependency of my project. That has a dependency on origin repository of SwiftProtobuf.
Now I got this warnings below, what can I do to prevent this warnings?

1 Like

The fork of protobuf needs to change the name in the Package.swift: otherwise it's pretending to be the upstream package, which cannot end well.

I tried that, it ended up in strange other errors so I reverted the change.

The name is solely for user‐facing display purposes. The identity of a URL dependency comes from the last path component of the URL.

You can do one of five things:

  1. You can fix it permanently for everyone, even clients, by getting your changes upstreamed into the official repository of SwiftProtobuf.

  2. You can fix it permanently for everyone, even clients, by forking Firebase and changing its dependency to point at your fork as well. The downside is that your package becomes incompatible with the official Firebase and any client that tries to use both will encounter the same problem you had.

  3. You can permanently fix it for a local network or device by configuring a mirror to point the official Protobuf URL at your fork’s URL instead.

  4. You can temporarily fix it while you are working by using only the official URL, but dragging a local working copy of the fork into the same workspace to use it as an editing override.

  5. You can change your fork enough to dodge all name clashes with the original SwiftProtobuf, so that SwiftPM believes them to be distinct packages and the two can safely be used together. You will need to at least change the last component of the URL, the package name and each reachable module name.