optimizely / swift-sdk

Swift SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy)
https://www.optimizely.com/products/full-stack/
Apache License 2.0
21 stars 30 forks source link

Name conflict when adding the Optimizely SDK via SPM #474

Closed dbarden closed 1 year ago

dbarden commented 1 year ago

Description

At our project, we are having an issue when adding the Optimizely SDK via Swift Package Manager. There is a naming conflict when adding the SDK and it reports the Package is already used in the project.

This happens because Swift Package Manager uses the last component of the URL path as the identifier. So in case there is another package named swift-sdk (like this one), the Package.resolved file will be

    {
      "identity" : "swift-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Iterable/swift-sdk.git",
      "state" : {
        "revision" : "8d984cf6c2ea7edb1c97a3585fa632af6be43de0",
        "version" : "6.4.7"
      }
    },
    {
      "identity" : "swift-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/optimizely/swift-sdk.git",
      "state" : {
        "revision" : "193cc00e1004d29f16f7b32e5b6787199760c482",
        "version" : "3.10.1"
      }
    },

Which will generate the conflict.

Workaround

To be able to integrate the Optimizely SDK on our project, we had to create a fork and change the name of the repository. This experience is less than ideal since it requires use to periodically update the fork to fetch updates and new releases instead of just fetching from the official source.

Expected behaviour

It should be possible to use the Optimizely SDK along with other Packages, and therefore the name of the repository should be changed. I know it looks like a lot, but GitHub supports repository redirects and when a repository is renamed, the old location keeps working as before. From the documentation:

In addition to redirecting web traffic, all git clone, git fetch, or git push operations targeting the previous location will continue to function as if made on the new location.

This way, we can support the integration of Optimizely SDK directly from the official repository.

dbarden commented 1 year ago

Duh, https://github.com/optimizely/swift-sdk/issues/450