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

Adding graphviz support in dump #852

Merged
merged 3 commits into from
May 4, 2020

Conversation

jeffctown
Copy link
Contributor

@jeffctown jeffctown commented Apr 29, 2020

Hey there! πŸ‘‹

Motivation

I came here looking for the same thing mentioned in #646: a way to output a dependency graph from xcodegen project files

Whats in this PR

I added support, like specified in the linked issue.

The following will output a Graphviz to stdout:

xcodegen dump --type graphviz

And this will output to a file:

xcodegen dump --type graphviz --file ~/Desktop/output.viz

When the output is pasted into an online graphviz tool it can produce a target dependency graph based on xcodegen project files.

This was created from the Test Fixture project in Tests/Fixtures/TestProject/:

TestProjectDependencyGraph

What Should We Discuss?

Well, I'm adding a dependency on a graphviz package. It is actively maintained.

Is this worth adding a dependency? πŸ€·β€β™‚οΈ

Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic @jeffctown, thank you! πŸŽ‰ I'm not too familiar with graphviz, are there any attributes or settings you would suggest for showing what sort of dependency a node is? (carthage, target..ect)

Updating README
Adding Changelog entry
@jeffctown
Copy link
Contributor Author

jeffctown commented May 2, 2020

@yonaskolb - What a great question! This got me thinking, and I decided to update the style to be as close to a UML dependency diagram as possible. My hope is that by using a standard, the diagrams will be understandable by the broadest audience.

Changes Since Last Review:

  1. Updated all Nodes' shape to be a box.
  2. Updated Edges to use dashed lines since they are dependencies.
  3. Updated dependency labels to include <<external>> for any dependency targets who's type is not .target (external to the project).
  4. I also added a CHANGELOG entry, and updated the README.

Updated TestProject Diagram:

Graph

var graphVizName: String {
switch self.type {
case .bundle, .package, .sdk, .framework, .carthage:
return "<<external>>\\n\(reference)"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about including the name of the dependency type instead of external? Same as enum cases but strings

[carthage]
Alamofire

Copy link
Contributor Author

@jeffctown jeffctown May 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here, with a few tests.

GraphViz-Final-NoReally

Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Thanks again @jeffctown! I think this will be really useful for many people

@yonaskolb yonaskolb merged commit 98275e9 into yonaskolb:master May 4, 2020
@jeffctown jeffctown deleted the feature/graphviz branch October 16, 2020 11:47
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

Successfully merging this pull request may close these issues.

None yet

2 participants