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

[SR-8658] Implement SE-0226 Package Manager Target Based Dependency Resolution #4759

Open
neonichu opened this issue Aug 28, 2018 · 9 comments

Comments

@neonichu
Copy link
Member

Previous ID SR-8658
Radar rdar://problem/44105619
Original Reporter @neonichu
Type New Feature
Additional Detail from JIRA
Votes 6
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: b2a9b01fe8077a3dd6b48f8e8e7ce7ad

Issue Description:

This tracks implementing the SE-0226 Package Manager Target Based Dependency Resolution proposal.
Proposal is here: https://github.com/apple/swift-evolution/blob/master/proposals/0226-package-manager-target-based-dep-resolution.md
This proposal is for enhancing the package resolution process to resolve the minimal set of dependencies that are used in a package graph.

@ankitspd
Copy link
Member

ankitspd commented Sep 4, 2018

@swift-ci create

@ankitspd
Copy link
Member

Swift 5.2 has partial implementation of this proposal where SwiftPM is able to skip dependencies that are not exported via any product.

@pavm035
Copy link

pavm035 commented Sep 22, 2023

@neonichu @aciidb0mb3r Any updates on this when to release this support? We are getting a bunch of test target dependencies and they are conflicting with the host app.

@neonichu
Copy link
Member Author

The 5.2 partial implementation should take care of test target dependencies, but only for transitive dependencies, not for root packages.

@pavm035
Copy link

pavm035 commented Sep 26, 2023

@neonichu Thanks for the feedback, i'm not sure if i understood correctly, our Swift version for the packages is 5.7 but when we integrated SDK which depends on testing framework(Quick, Nimble) and the same testing frameworks are linked to main app using SPM, so the conflicts still happens, do you mean this issue is addressed as well in Swift 5.2?

@neonichu
Copy link
Member Author

Do you have an example you could share? AFAIK, this scenario should work, the test-only dependencies of a dependency should not matter at all.

@pavm035
Copy link

pavm035 commented Sep 28, 2023

@neonichu I have attached sample code, when you try to build the app you get following error

Failed to resolve dependencies Dependencies could not be resolved because 'mylibrary' depends on 'quick' 5.0.0..<6.0.0 and root depends on 'quick' 7.3.0.

SPMDependencyDoctor.zip

@neonichu
Copy link
Member Author

The issue here is that "MyLibrary" is actually not a dependency but another root package in which case all of its dependencies need to be resolved.

You could fix this by instead adding "MyLibrary" as a local dependency:

  • Remove the existing reference to it from the Xcode project
  • Use File => Add Package Dependencies => Add Local... to add it as a local dependency instead (I believe this may need Xcode 15 or at least 14.3)

After doing this, your package will show up as a local dependency instead and the Quick/Nimble dependencies won't matter anymore. The drawback is that you cannot run tests of dependencies, though.

Screenshot 2023-09-27 at 17 40 25

@pavm035
Copy link

pavm035 commented Sep 28, 2023

@neonichu Cool, looks like it's working. But the option you mentioned Use File => Add Package Dependencies => Add Local is only available from Xcode 15, but with older version of xcode still it has conflicts issue

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

4 participants