Boost logo

Boost-Build :

Subject: [Boost-build] Dependency Graph Visualization
From: aaron_at_[hidden]
Date: 2015-03-16 17:50:18


Hi All!

I've been asked to create a visualization of the full dependency graph that Boost.Build creates. The information that would like to be seen includes the main targets and their alternatives, actual targets, and header files as seen by the scanners. Outside of Boost.Build, I plan on using D3.js for the visualizations, so having the data in the form of JSON would be best.

I will be doing this on the Python port, so output to JSON will be easy. I planned on using bits from the --out-xml implementation in order to get started.

I would like to make a function similar to virtual_targets.traverse() that can be used to construct the graph of any given target and return the JSON of that graph. If a user specifies --out-json on the command-line, the aforementioned function will be passed the top level targets and the JSON graph will be output into the file specified.


I have a few questions first:

In order to get the header files that each file depends on, I need to use the scanners, however, the scanners are used during an UPDATE within the engine. For the Python port, is there a reason to keep the header file scanning (as well as caching) within the engine? Would it be too slow to move that portion of dependency discovery into Python during the actualization phase? For the purposes of outputting just the JSON with no intention to build, is there a way to get the headers using the existing Scanners?

For my company's visualization concerns, I would like to be able to create a pre-build hook that allows me to grab the same top-level targets, call the function I want to create to get the JSON dependency tree, then dump an HTML file that contains the framework and setup for using the dependency graph data with D3.js. However, the call to the pre-build hook doesn't pass any information to the hook and there isn't any way (that I can tell) to grab the top level targets from inside of the hook. Once Vladimir's server branch is complete, it would be nice if the Builder instance was passed into the pre and post build hooks so that any of the hooks had access to all of the build information. Is there a good way to get the top level targets?

Last question: when should the build system be used to create an output file and when should Python be used? For example, --out-xml created a target to output the file and special care was taken to ensure that the XML would be output every time --out-xml was specified on the command-line. Using Python, it seems like this would be much easier (at least for the JSON implementation) to just open a file and then write the json.dumps() output to the file. I'm more of a Python developer than a build systems developer so that would be the reason for my affinity to the Python solution :D

I can think of a lot of ways to hack up this feature, but I would like to do it the correct way that would be beneficial for everyone. Any tips or discussion would be greatly appreciated.

Thanks!
Aaron

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk