Skip to content
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

Avoid sharing schemes with library users #29

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

davdroman
Copy link

@davdroman davdroman commented Nov 1, 2022

Description

When consuming this library as a dependency in my project, I noticed Xcode autogenerated a scheme for the library among my local schemes, which is not desirable behavior.

As a workaround, this PR gitignores .swiftpm altogether and introduces an xcworkspace as a scheme container that disallows SPM from leaking schemes onto consumers.

Libraries as big as TCA use this approach to effectively hide away all its schemes (and subdependency schemes) from users.

Checklist

  • this PR is based on the main branch and is up-to-date, if not please rebase your branch on the top of main
  • the commits inside this PR have explicit commit messages
  • unit tests cover the new feature or the bug fix
  • the feature is documented in the README.md if it makes sense
  • the CHANGELOG is up-to-date

@twittemb
Copy link
Contributor

twittemb commented Nov 9, 2022

Thanks for the PR. I'll review it ASAP

@twittemb
Copy link
Contributor

Hi,

I’ve just learned about @_implementationOnly. I think it allows to hide the internal deps from the consumer. Perhaps it could address the issue you’re describing?

Have you already used such a statement?

@davdroman
Copy link
Author

AFAIK that only helps ensure that internal modules aren't visible to consumers, but schemes are still exported because they're included in the .swiftpm folder so Xcode sees them regardless of module visibility.

Ref: https://forums.swift.org/t/preventing-spm-packages-dependencies-from-being-exported-when-importing-the-package/43660

@Sajjon
Copy link

Sajjon commented Jan 8, 2023

This is a nice addition! Without this Xcode selects AsyncExtension as active scheme because it starts with "A" instead of my host SPM project Foo which has a dependency on AsyncExtension. The effect of this is when I open Xcode and press CMD U to test, Xcode tries to test AsyncExtension which fails.

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

Successfully merging this pull request may close these issues.

None yet

3 participants