today, SPM does not really have a great way of dealing with very generic, common package names. for example, one might have a package basics that would appear in a Package.resolved file like:
{
"identity" : "basics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tayloraswift/basics.git",
"state" : {
"revision" : "980c9b0d117e7ac955d5caf38306f9c38e0dcaa3",
"version" : "0.10.4"
}
},
this doesn’t really cause problems within a single build tree, since colliding package names are already forbidden. (although one might become very frustrated when trying to add a dependency on a package with a name conflict.) but when building “bird’s eye” package tooling that analyzes many packages from many authors, it becomes necessary to assign a more-unique identity to such packages, like tayloraswift.basics.
an extreme solution would be to forget about the identity field and just use the git repo URL as the package identity. but the URL can take a lot of non-canonical forms, and it is not straightforward to discard irrelevant URL features in a general manner, especially if packages are mirrored across multiple hosting providers.
even today, there is no public, centralized package registry that we can kick the problem to, and no plans from the language team to create/fund one, so it is motivating to come up with an appropriate decentralized rule for identifying packages until such a thing exists.
i propose we settle on using the penultimate URL path component as the scope component of a package identifier. therefore all of the following package URLs would coalesce to the same package identifier tayloraswift.basics:
https://github.com/tayloraswift/basics
https://gitlab.com/tayloraswift/basics
https://mycompany.com/mirrored-repos/tayloraswift/basics
WDYT?