Xcode Target-based package resolution?

Is it possible to find out what packages a single Xcode target depends on?

For context, I'm working on a project that has several different targets in its Xcode project.
These targets sometimes have different Swift packages as their dependencies:

  • Target 1: Depends on Package A
  • Target 2: Depends on Package B

The generated Package.resolved file will contain both Package A and Package B.

Now, we're trying to create a script (or use LicensePlist) to automatically generate a list of open source licenses.

  • When we base the script on Package.resolved, there are too many packages listed
  • When we base the script on the Xcode project, there are too few packages listed (Xcode only lists direct dependencies, but not dependencies' dependencies)

Swift Package Manager can generate dependency graphs (which I use in SourceDocs like this)

The command is

swift package show-dependencies

However, since Xcode does not have a Package.swift file, I haven't found a way to do this from the command line.

My recommendation would be to create a "fake" package with the same (empty) targets and dependencies, and then run the command.

1 Like
Terms of Service

Privacy Policy

Cookie Policy