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

Option for getting dependencies of a specific target? #119

Open
jverkoey opened this issue Aug 12, 2024 · 2 comments
Open

Option for getting dependencies of a specific target? #119

jverkoey opened this issue Aug 12, 2024 · 2 comments

Comments

@jverkoey
Copy link

I have multiple Xcode projects in a single workspace. Each project has one or more targets, and each target has a unique set of Swift package dependencies.

The docs for this tool indicate that it might only get you the dependencies for a project, swift-package-list <project-path>; is there a possibility of getting dependencies for a specific target as well?

Possibly related, I get the following error when trying to run the command:

> swift-package-list MyApp.xcodeproj
Error: The file “Package.resolved” couldn’t be opened because there is no such file.

Notably, I am using Xcode's UI to manage all of my Swift package dependencies.

@FelixHerrmann
Copy link
Owner

Hey @jverkoey, thanks for reaching out!

Let me clarify things a bit: this tool relies on the contents of Package.resolved; depending on which kind of project you have (Xcode project/workspace, Swift package, Tuist project) this file is located in various places. Once you add a Xcode project to a workspace the workspace manages SPM so you have to run the tool with the workspace path, e.g. swift-package-list Test.xcworkspace.

Now to your actual question if you can configure it to filter by target: This information is not part of the Package.resolved, the only reliable method would be to parse project.pbxproj AFIAK. In the case of a workspace it is not even project specific, the Package.resolved will contain the packages from all the workspace's projects. So to answer it, no it is not possible and it would also not be a simple addition (not sure how easy it is to parse the project file, but if you think about sub-dependencies which are not declared at all and SPM plugins things get quiet complex).

@FelixHerrmann
Copy link
Owner

As a temporary solution you can use the just-added --ignore-package option to exclude individual packages manually, see #123 for more details.

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

No branches or pull requests

2 participants