I believe the implementation of SE-0226 is overly restrictive, not allowing the
name parameter for a dependency to be overridden which leads to an issue when depending on two Swift Packages that declare the same Package Name. I'm happy to file a bug on this, but want to ensure that my expectations are correct. Originally discovered in firebase-ios-sdk#6357.
I created a repo at https://github.com/ryanwilson/GitHub-6357 that uses the Firebase repo and a dummy repo I created that uses the same package name (
"Firebase"). This is using Xcode 12.0 that was just released.
Essentially, when using two dependencies that use the same name an error occurs that recommends using the
name argument to differentiate:
"error: duplicate dependency named 'Firebase'; consider differentiating them using the 'name' argument"
After using the
name parameter in
dependencies as recommended to rename one from "Firebase" to "DummyFirebase" it eventually fails with:
error: declared name 'DummyFirebase' for package dependency 'https://github.com/ryanwilson/DummyFirebasePackage.git' does not match the actual package name 'Firebase'
It's also reproducible when just trying to give the plain Firebase repo a different name other than
Firebase, but this is mostly an issue for when two dependencies use the same name.
I believe the implementation lives in this function of
PackageGraphLoader.swift. I'm happy to make an attempt at a fix, I'd only like some guidance on what the expectation is here. I am guessing that the restriction for matching the expected name should only exist if a custom name argument was not provided to the dependency (so it's using the name given to it in the original Package manifest), but would like to double check!