/depend

Dependency Tool for D

Primary LanguageDBoost Software License 1.0BSL-1.0

Dependency Tool for D

This tool checks actual import dependencies against a UML model of target dependencies.

Usage

Run dmd with the switch --deps to extract the actual dependencies. For example:

dmd -deps=dependencies src/depend.d -o-

Use the depend tool together with the Graphviz programs for a visualization of the module dependencies:

src/depend.d --dot dependencies | dot -Tsvg -odependencies.svg

For best results, remove the transitive dependencies:

src/depend.d --dot dependencies | tred | dot -Tsvg -odependencies.svg

Consider switching to package dependencies instead of module dependencies:

src/depend.d --packages --dot dependencies | tred | dot -Tsvg -odependencies.svg

Or filter dependencies of source files matching a regular expression:

src/depend.d --filter 'src|test' --dot dependencies | tred | dot -Tsvg -odependencies.svg

Then, specify the target dependencies as a PlantUML model. For example, create a text file model.uml:

package model {}
package view {}
package controller {}

controller ..> view
controller ..> model
view .> model

Finally, use the depend tool for checking actual dependencies against the target dependencies:

src/depend.d --target model.uml dependencies

The tool complains about violations:

error: unintended dependency model -> controller