Dimple

D import-list explorer

Introduction

Dimple, or "D import-list explorer", extracts import declarations from D source files and builds a dependency graph for visualization (requiring AT&T's open-source GraphViz package.)

Here is an example: dependency graph of Ben Hinkle's MinTL library.
dependency graph of MinTL generated by dimple

As shown above, Dimple highlights the modules in a cycle of dependency (mintl.array and mintl.seq.)

Download Dimple

Dimple is distributed in D source code under the terms of GNU General Public License.

Download dimple.d v0.13 (8kb)

Digital Mars's D compiler is needed to build Dimple:
dmd -release -O dimple.d

GraphViz package is also required if you prefer pictures to plain text.

Usage

dimple module { -switch }

module
name of the root module (e.g. dmdscript.program), or a space-separated list of names (e.g. mintl.list mintl.arraylist.) Dimple generally needs one entry module to get started, as it automatically follows import statements to process the rest of modules.
-x=regexp
this option forces Dimple to ignore all the modules that match the regular expression "regexp" (e.g. -x=global). It might be handy when you are examining a big project.

Example:
dimple dmdscript.program "-x=\.(script|dobject)" | dot -Tps -odmdscript.ps
Final result:
dmdscript.pdf (6kb)
(a dependency graph of Walter Bright's DMDScript, excluding the module dmdscript.script and dmdscript.dobject.)

Author

Wang Zhen
email: nehzgnawATgmailDOTcom

Acknowledgement

Anders F Björklund

Notes

Dimple is a quick hack without much testing yet. Be prepared for its bu... ugh, I mean "features." :-)

For a better understanding of the cyclic dependency problem, please check the Acyclic Dependencies Principle (page 6) and the Dependency Inversion Principle.