[Qbs] Get rid of extra product type statements when generating graphviz dependency graphs using qbs

qbs at mein-briefkasten.net qbs at mein-briefkasten.net
Sun Dec 11 19:08:43 CET 2022


Hi all,

I’ve played around with qbs to get a app/lib dependency graph generated using the graphviz. Basically I got it working but I’m not happy with the way how to integrate it an existing project.

The attached example illustrates it.

The basic idea is to add

Depends { name: "depgraph” }

to every product (i.e. static/dynamic lib and app) that should appear in the dependency graph. Each of those product generate a dot-fragment with its name and its direct dependencies.
Finally another rule is applied that merges the dot-fragments into the final dot file, that is represented by a Product of type “dot”.

To get the desired output I had to add an additional statement to the qbs files that I did not want to be there:

Just "Depends { name: "depgraph” }” was not enough, I had to extend the type of every lib to get all dependencies show up in the graph, i.e.

Depends { name: "depgraph" }
type: base.concat(["dot-fragment”])

Don’t understand why this is needed and I’d like to get rid of it. If other stuff can be simplified I would be very happy for suggestions.

The leanest way from a qbs user perspective would be to just do a
-----
CppApplication {
	name: “app”
	...
}

DotDependencyGraph {
	name: “app-dependency-graph”
	Depends { name:  “app” }
}
-----
So no need to add a Depends to every related product and just pull the dependencies via the single app dependency, but no idea if this would be possible and how to do it.

Thanks and best regards,
Max

P.S: I also attached the correct, desired graph output for reference


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20221211/e93618f4/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qbstest.zip
Type: application/zip
Size: 9929 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20221211/e93618f4/attachment-0001.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20221211/e93618f4/attachment-0004.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: app-dependency-graph.dot.pdf
Type: application/pdf
Size: 12507 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20221211/e93618f4/attachment-0001.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20221211/e93618f4/attachment-0005.htm>


More information about the Qbs mailing list