How can I export a .dot file for dependency graph of Swift package target?

I'm using Swift package manager pretty extensively in my application - for all 3rd party packages, as well as ~150 local targets across ~9 local packages. My application target basically just imports the root of the swift package dependency graph and has the AppDelegate / SceneDelegate. I would like to export the resolved dependency graph including local and remote targets in a .dot graphviz format which I can visualize.

I know that this is possible because this PR was merged a while ago:

But I'm not sure how to invoke this either through Xcode or from the command line.
I'd love to be able to do something like:

swift build MyRootTarget --show-dependencies > graphviz

And see the graph of all the transitive dependencies of my root target.

Terms of Service

Privacy Policy

Cookie Policy