Skip to content

Conversation

@artemcm
Copy link
Contributor

@artemcm artemcm commented Sep 8, 2022

It can be nice to be able to visualize all of a module's dependencies.

A followup change will wire it up to a driver flag to allow an arbitrary driver invocation to emit this to a specified path.
(Such flags must first be added in the main swift repo)

@artemcm artemcm requested review from bnbarham and nkcsgexi September 8, 2022 23:37
@artemcm
Copy link
Contributor Author

artemcm commented Sep 8, 2022

@swift-ci test

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

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

Nice :). Love me some dependency graphs!

Comment on lines 1219 to 1224
let outputFile = path.appending(component: "dependency_graph.dot")
var outputStream = try! ThreadSafeOutputByteStream(LocalFileOutputByteStream(outputFile))
serializer.writeDOT(to: &outputStream)
outputStream.flush()
let contents = try localFileSystem.readFileContents(outputFile).description
print(contents)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you purposefully texting writing out here, or can this just be an in-memory string?

Also there's a couple of try! here but this is just a test and the method already throws, so they don't really seem needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The primary use for this will be writing out to some kind of output stream so it doesn't hurt to use as such here.

Removed the try!, thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

I was imagining you'd test that with the option when it's added. But I don't really mind either way 🤷

It can be nice to be able to visualize all of a module's dependencies.
@artemcm artemcm force-pushed the DOT_ModuleGraphSerializer branch from 1b7efb3 to b35358f Compare September 9, 2022 00:29
@artemcm
Copy link
Contributor Author

artemcm commented Sep 9, 2022

@swift-ci test

@artemcm artemcm merged commit e53435f into swiftlang:main Sep 9, 2022
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.

3 participants