常规更新
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$targets = @PSC_TARGETS@
|
||||
$edges = @PSC_TARGET_EDGES@
|
||||
$outputDir = '@PSC_OUTPUT_DIR@'
|
||||
$format = '@PSC_FORMAT@'
|
||||
$dotExe = '@PSC_DOT_EXECUTABLE@'
|
||||
New-Item -ItemType Directory -Force -Path $outputDir | Out-Null
|
||||
function Convert-To_Dot_Text([string]$text) {
|
||||
return $text.Replace('"', '\"')
|
||||
}
|
||||
$lines = [System.Collections.Generic.List[string]]::new()
|
||||
$lines.Add('digraph "radio cmake_targets" {')
|
||||
$lines.Add('rankdir=LR;')
|
||||
$lines.Add('splines=ortho;')
|
||||
$lines.Add('concentrate=true;')
|
||||
$lines.Add('forcelabels=true;')
|
||||
$lines.Add('graph [fontname="Consolas", label="radio cmake_targets", labelloc=t, fontsize=18];')
|
||||
$lines.Add('node [shape=box, style="rounded,filled", fontname="Consolas", fontsize=10];')
|
||||
$lines.Add('edge [fontname="Consolas", fontsize=9];')
|
||||
foreach ($target in $targets) {
|
||||
$safe = Convert-To_Dot_Text $target
|
||||
$lines.Add('"' + $safe + '" [label="' + $safe + '", tooltip="' + $safe + '", fillcolor="#dcfce7"];')
|
||||
}
|
||||
foreach ($edge in $edges) {
|
||||
$parts = $edge.Split('|')
|
||||
if ($parts.Count -eq 2) {
|
||||
$left = Convert-To_Dot_Text $parts[0]
|
||||
$right = Convert-To_Dot_Text $parts[1]
|
||||
$lines.Add('"' + $left + '" -> "' + $right + '" [xlabel="links"];')
|
||||
}
|
||||
}
|
||||
$lines.Add('subgraph cluster_legend {')
|
||||
$lines.Add('label="legend";')
|
||||
$lines.Add('style="rounded,dashed";')
|
||||
$lines.Add('"legend_target" [label="cmake target", fillcolor="#dcfce7"];')
|
||||
$lines.Add('"legend_edge" [label="edge = target_link_libraries / target dependency", fillcolor="#f8fafc"];')
|
||||
$lines.Add('}')
|
||||
$lines.Add('}')
|
||||
$dotFile = Join-Path $outputDir 'radio_cmake_targets.dot'
|
||||
$imageFile = Join-Path $outputDir ('radio_cmake_targets.' + $format)
|
||||
Set-Content -LiteralPath $dotFile -Value $lines -Encoding UTF8
|
||||
& $dotExe ('-T' + $format) $dotFile '-o' $imageFile
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
$items = @(
|
||||
'radio_directory_tree',
|
||||
'radio_module_dependency',
|
||||
'radio_cmake_targets',
|
||||
'radio_include_dependency',
|
||||
'radio_render_architecture'
|
||||
)
|
||||
$html = [System.Collections.Generic.List[string]]::new()
|
||||
$html.Add('<!doctype html><meta charset="utf-8"><title>Radio Graphviz</title><h1>Radio Graphviz</h1><ul>')
|
||||
foreach ($item in $items) {
|
||||
$file = $item + '.' + $format
|
||||
if (Test-Path -LiteralPath (Join-Path $outputDir $file)) {
|
||||
$html.Add('<li><a href="' + $file + '">' + $item + '</a></li>')
|
||||
} else {
|
||||
$html.Add('<li>' + $item + ' (not generated)</li>')
|
||||
}
|
||||
}
|
||||
$html.Add('</ul>')
|
||||
Set-Content -LiteralPath (Join-Path $outputDir 'index.html') -Value $html -Encoding UTF8
|
||||
Reference in New Issue
Block a user