Contents

luizzak/targetdependencychecker

A simple command-line tool for analysing (local) dependencies between targets defined in Swift Package Manager projects, as well as catch any non-dependency import errors that can arise in larger target graphs.

GraphViz generation

Graphviz files containing the dependency tree of a package can be generated using TargetDependencyChecker graph:

$ swift run TargetDependencyChecker graph --help

OVERVIEW: 
Produces a GraphViz .dot file describing the internal dependency graph of a Swift Package Manager project.

USAGE: TargetDependencyChecker graph [--package-path <package-path>] [--output <output>] [--include-indirect] [--include-tests] [--include-folder-hierarchy]

OPTIONS:
  -p, --package-path <package-path>
                          Specifies the path for the directory containing a Package.swift manifest for a Swift Package Manager project.
                          If not specified, defaults to the current working directory.
  -o, --output <output>   A .dot file to write the results to, relative to the current working directory. If not provided, prints the result to stdout, instead.
  -i, --include-indirect  Include indirect dependencies via `import` statements on target's files.
  -t, --include-tests     Include test targets in the graph.
  -f, --include-folder-hierarchy
                          Include information about the target's folder hierarchy as clusters in the graph.
  -h, --help              Show help information.

You can also use the sample project to generate a demo graph file:

$ swift run TargetDependencyChecker graph -p ./TestPackage/

Will produce:

digraph {
    graph [rankdir=LR]

    0 [label="Core"]
    1 [label="IndirectCore"]
    2 [label="IndirectCoreRoot"]
    3 [label="TestPackage"]

    0 -> 1
    1 -> 2
    3 -> 0 [label="@ /Sources/TestPackage/TestPackage.swift", color=red]
}

Package Metadata

Repository: luizzak/targetdependencychecker

Default branch: master

README: README.md