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
Excluding an SPM Dependency from a build by reading a flag #6271
Comments
Xcode only supports selecting dependencies based on the configuration being built, not on a certain value of a project build setting. You might be able to achieve that with imports implicitly resolved, but I advise not to, because many Xcode features, such as Swift Previews, rely on explicitness to work reliably. Does it answer your question? |
Hi @pepicrft thank you for your quick reply. Per configuration import would be okay; what's the best way to achieve it via Tuist? |
Sorry, my bad; I meant destination and not configuration. I think you'll have to resort to build settings magic to conditionally do that, like CocoaPods does, but as I mentioned, this is generally not a good idea. |
Upon further thought, I have come to the conclusion that it would be much easier and faster to send to the Tuist generate (or read via environment variable) a setting that tells me whether to create a project/target that includes that framework or not. This way, I can easily handle this scenario by choosing the best configuration depending on whether it's a development, testing, or production build. |
That sounds like a good way forward! We're closing the issue as there's no action item for us here 🙂 |
What problem or need do you have?
Hello, I wanted to know if there is a way to exclude a specific dependency (specifically a locally imported framework via SPM) from the builds by reading the presence of a defined flag (e.g., RELEASE/DEBUG/TESTING) within the project settings. The framework should not be compiled or included in the final IPA
I think I could use the
condition
inTargetDependency
but I'm not sure how I could read a settings flag, I can see only thePlatformFilter
as possible argument: while I would to use the configuration (in pure SPM something like.target(name: "XXXX", condition: .when(configuration: .debug))
):Potential solution
No response
macOS version
14.4.1
Tuist version
4.x
Xcode version
15.x
The text was updated successfully, but these errors were encountered: