It would be very interesting and valuable to build a graphing tool to expose the hierarchy and interaction between modules classes, methods, etc in the SwiftPM project.
Something like:
This would be very helpful to understand the project structure, and it will make it easier to contribute to it.
Process:
- Information gathering
- Thoughts
- Help
1. Information Gathering
I asked @Mattt [who contributes to SwiftDoc] about how can we get the information to build this documenting/graphing tool and he pointed out:
Equivalent information can now be surfaced by SourceKit directly when run on any Swift code (no derived headers required).
Which is better for us because we can lean on SourceKit or SourceKitten to build this tool.
Is it better to build this tool on top of SwiftDoc or to make it from scratch?
I asked something similar to @Mattt and he answered:
The code of SwiftDoc.org could be used to bootstrap such an effort, but my personal opinion is that a new, “clean room” implementation would be a better solution.
2. Thoughts
I started to dig a little more into this, and there are two tools that can be very helpful for us to build this graphing tool:
Initial idea
The initial idea is to build a tool that uses SourceKitten and generates a JSON ready to be graphed, I mean, a more friendly JSON that relates the different parts of the SwiftPM project.
Then, on top of that we can build different graphing tools that expose better the SwiftPM project.
Also I think we can generate documentation with Jazzy and complement the graphing tool with this docs.
We need to improve the SwiftPM docs before start generating docs with Jazzy.
General idea, wraping up:
- Build a parser on top of SourceKitten that generates a JSON that makes it easier to relate all the modules/classes/functions, etc.
Let's call this "parser"
SwiftPM SourceGrapher
or justSwift SourceGrapher
if it can be used on any Swift project
-
Improve SwiftPM documentation to generate docs with Jazzy.
-
Build documenting/graphing tools on top of
SwiftPM SourceGrapher
. -
Make a site with all this tools, something similar to SwiftDoc
3. Help
-
The
SwiftPM SourceGrapher
should be SwiftPM specific or if it can target any Swift project? -
What are other ways to accomplish this?
-
Any other useful tools that I didn't mentioned?
P.S.
I am very new to all of this; correct me if I am making naive asumptions or something similar.
Please share tips and ideas for building this useful tool that can improve how developers join and contribute to the SwiftPM Project.