Call graph and dependency analyzer wrapper for Delphi source code, with JSON, DOT, and text outputs.
delphi-callgraph wraps graph engines behind one PowerShell command surface.
The default engine is radCallGraph.exe, which can emit JSON, DOT, and text
summary output from Delphi source. The wrapper also supports DOT dependency
graphs from PasDoc and from the Delphi compiler GraphViz option.
Designed for use as a standalone command and as a future bundled tool inside delphi-powershell-ci.
pwsh -File .\source\delphi-callgraph.ps1 -Path source `
-Formats json,dot,txt -OutputDir artifacts\callgraphWith an explicit engine path:
pwsh -File .\source\delphi-callgraph.ps1 -Path source `
-EnginePath C:\tools\radCallGraph.exe `
-Class TMyService -Formats json,dotRuns on Windows PowerShell 5.1 (powershell.exe) and PowerShell 7+ (pwsh).
The test suite requires PowerShell 7+.
| Engine | Default executable | Outputs | Notes |
|---|---|---|---|
radCallGraph |
radCallGraph.exe |
json, dot, txt |
Default engine for call graph analysis |
PasDoc |
pasdoc.exe / pasdoc |
dot |
Uses --graphviz-uses and --graphviz-classes |
DCC |
dcc32.exe / dcc32 |
dot |
Uses compiler --graphviz output |
| Parameter | Default | Description |
|---|---|---|
-Path |
Source files or directories to analyze. | |
-Engine |
radCallGraph |
Graph engine: radCallGraph, PasDoc, or DCC. |
-EnginePath |
auto-detect | Explicit path to the engine executable. |
-OutputDir |
callgraph |
Directory for generated graph files. |
-Formats |
json for radCallGraph, dot otherwise |
Comma-separated formats: json, dot, txt. |
-JsonFile |
callgraph.json |
Explicit JSON output path. |
-DotFile |
engine-specific | Explicit DOT/GV output path. |
-SummaryFile |
callgraph.txt |
Explicit text summary path. |
-Class |
radCallGraph class filter. | |
-Annotations |
$true |
Include {cg:...} annotation data for radCallGraph. |
-Deterministic |
$true |
Pass --deterministic to radCallGraph for reproducible output without timestamps. |
-GraphKind |
engine default | call, uses, classes, dependency, or all. |
-GraphVizUses |
off | PasDoc unit dependency graph. |
-GraphVizClasses |
off | PasDoc class hierarchy graph. |
-PasDocOptions |
@() |
Extra PasDoc options passed before source paths. |
-ProjectFile |
DCC project file for compiler GraphViz output. | |
-GraphVizExclude |
@() |
DCC unit patterns for --graphviz-exclude. |
-EngineArguments |
@() |
Extra arguments passed to the selected engine. |
-TimeoutSeconds |
300 |
Maximum engine runtime before failure. |
-OutputFile |
Structured JSON result file for CI integration. |
pwsh -File .\source\delphi-callgraph.ps1 -Path source `
-Engine radCallGraph `
-Formats json,dot,txt `
-OutputDir artifacts\callgraphpwsh -File .\source\delphi-callgraph.ps1 -Path source `
-Class TOrderService `
-Annotations:$false `
-JsonFile artifacts\callgraph\orders.jsonGenerate a unit dependency graph:
pwsh -File .\source\delphi-callgraph.ps1 -Path source `
-Engine PasDoc `
-GraphKind uses `
-Formats dot `
-OutputDir artifacts\pasdoc-graphGenerate both unit and class graphs:
pwsh -File .\source\delphi-callgraph.ps1 -Path source `
-Engine PasDoc `
-GraphKind all `
-Formats dotPasDoc writes GVUses.dot and/or GVClasses.dot in the output directory.
pwsh -File .\source\delphi-callgraph.ps1 `
-Engine DCC `
-ProjectFile source\MyApp.dpr `
-GraphVizExclude System.*,Vcl.*,Winapi.* `
-Formats dot `
-OutputDir artifacts\compiler-graphThe compiler writes a <project>.gv GraphViz file.
Use -OutputFile to write a JSON summary for CI tooling:
{
"engine": "radCallGraph",
"inputs": ["C:/repo/source"],
"exitCode": 0,
"success": true,
"outputDir": "C:/repo/artifacts/callgraph",
"formats": ["json", "dot"],
"files": {
"json": "C:/repo/artifacts/callgraph/callgraph.json",
"dot": "C:/repo/artifacts/callgraph/callgraph.dot"
},
"summary": {
"files": 34,
"nodes": 389,
"classes": 25,
"standalone": 36,
"edges": 1143
},
"duration": 1.2
}0 = success
1 = unexpected error
2 = invalid arguments
3 = engine executable not found
4 = input file or directory not found
5 = graph engine failed or timed out
Requires PowerShell 7+, Pester 5.7+, and PSScriptAnalyzer.
./tests/run-tests.ps1This tool is part of the Continuous-Delphi ecosystem, focused on strengthening Delphi's continued success.
