Skip to content

SPM - "swift-sdk" causes package name conflicts #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mrtnrst opened this issue Mar 10, 2022 · 6 comments
Closed

SPM - "swift-sdk" causes package name conflicts #450

mrtnrst opened this issue Mar 10, 2022 · 6 comments

Comments

@mrtnrst
Copy link

mrtnrst commented Mar 10, 2022

Overview

The way SPM imports happen uses the "repo name." Because of this, anyone importing this package, at any point, will conflict with other similarly named packages. Unsure of the correct course of action here, as this package is undoubtedly included in plenty of different projects.

I'll create this issue on Iterable (the other repo that initially caused this to show up) and link and tag to see if there can be a consensus on the outcome.

EDIT: Linking Iterable issue Iterable/iterable-swift-sdk#537

Example Project

I haven't made an example project, but you can recreate this issue by creating a blank project and adding both this SDK and the Iterable/swift-sdk SDK.

Workarounds

Currently, the only workaround I have found is forking the package in a separate repo to rename the repo and going from swift-sdk to optimizely-swift-sdk.

@mrtnrst mrtnrst changed the title SPM - "swift-idk" causes package name conflicts SPM - "swift-sdk" causes package name conflicts Mar 10, 2022
@jaeopt
Copy link
Contributor

jaeopt commented Mar 10, 2022

@mrtnrst Thanks for reporting. We'll take a look.

@jaeopt
Copy link
Contributor

jaeopt commented Mar 14, 2022

@mrtnrst It looks like a bug in Xcode. There can be many swift packages which can share the last part of unique urls (swift-sdk, ios-sdk, etc) and Xcode is supposed to use the url (or package name) as a reference. We filed a bug report to Apple. Interestingly, you're the first user who had this issue with multiple SDKs with the same names :)

@mrtnrst
Copy link
Author

mrtnrst commented Mar 18, 2022

@jaeopt looks like this is resolved in Xcode 13.3 as SPM updated to version 2 file format. I'll go ahead and close this ticket. Thanks for taking a look!

SpongeBob squarepants thank you

@mrtnrst mrtnrst closed this as completed Mar 18, 2022
@mrtnrst
Copy link
Author

mrtnrst commented Mar 18, 2022

Welp, I spoke too soon. After a clean/build it's failing again.
image

@mrtnrst mrtnrst reopened this Mar 18, 2022
@jaeopt
Copy link
Contributor

jaeopt commented Apr 6, 2022

@mrtnrst We created an aliased repo: "https://github.com/optimizely/optimizely-swift-sdk.git", same as the original one but you can use to manage the xcode name conflict. Let us know if you see any issue with the solution. Tx.

If you have a name conflict with other swift packages when you add the Optimizely swift-sdk dependency to Xcode, you can also try with its aliased repo: "https://github.com/optimizely/optimizely-swift-sdk.git"

@mrtnrst
Copy link
Author

mrtnrst commented Apr 8, 2022

@mrtnrst We created an aliased repo: "https://github.com/optimizely/optimizely-swift-sdk.git", same as the original one but you can use to manage the xcode name conflict. Let us know if you see any issue with the solution. Tx.

If you have a name conflict with other swift packages when you add the Optimizely swift-sdk dependency to Xcode, you can also try with its aliased repo: "https://github.com/optimizely/optimizely-swift-sdk.git"

Thanks for the follow-up! I've already done the same mitigation step when I encountered this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants