mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-03 10:14:39 +00:00
gendepend improvements; refs #5144
This commit is contained in:
@@ -24,7 +24,7 @@ type
|
|||||||
var gDotGraph: Rope # the generated DOT file; we need a global variable
|
var gDotGraph: Rope # the generated DOT file; we need a global variable
|
||||||
|
|
||||||
proc addDependencyAux(importing, imported: string) =
|
proc addDependencyAux(importing, imported: string) =
|
||||||
addf(gDotGraph, "$1 -> $2;$n", [rope(importing), rope(imported)])
|
addf(gDotGraph, "$1 -> \"$2\";$n", [rope(importing), rope(imported)])
|
||||||
# s1 -> s2_4[label="[0-9]"];
|
# s1 -> s2_4[label="[0-9]"];
|
||||||
|
|
||||||
proc addDotDependency(c: PPassContext, n: PNode): PNode =
|
proc addDotDependency(c: PPassContext, n: PNode): PNode =
|
||||||
|
|||||||
@@ -31,11 +31,19 @@ proc semanticPasses =
|
|||||||
registerPass verbosePass
|
registerPass verbosePass
|
||||||
registerPass semPass
|
registerPass semPass
|
||||||
|
|
||||||
|
proc writeDepsFile(g: ModuleGraph; project: string) =
|
||||||
|
let f = open(changeFileExt(project, "deps"), fmWrite)
|
||||||
|
for m in g.modules:
|
||||||
|
if m != nil:
|
||||||
|
f.writeLine(toFullPath(m.position.int32))
|
||||||
|
f.close()
|
||||||
|
|
||||||
proc commandGenDepend(graph: ModuleGraph; cache: IdentCache) =
|
proc commandGenDepend(graph: ModuleGraph; cache: IdentCache) =
|
||||||
semanticPasses()
|
semanticPasses()
|
||||||
registerPass(gendependPass)
|
registerPass(gendependPass)
|
||||||
#registerPass(cleanupPass)
|
#registerPass(cleanupPass)
|
||||||
compileProject(graph, cache)
|
compileProject(graph, cache)
|
||||||
|
writeDepsFile(graph, gProjectFull)
|
||||||
generateDot(gProjectFull)
|
generateDot(gProjectFull)
|
||||||
execExternalProgram("dot -Tpng -o" & changeFileExt(gProjectFull, "png") &
|
execExternalProgram("dot -Tpng -o" & changeFileExt(gProjectFull, "png") &
|
||||||
' ' & changeFileExt(gProjectFull, "dot"))
|
' ' & changeFileExt(gProjectFull, "dot"))
|
||||||
|
|||||||
Reference in New Issue
Block a user