From 4910a87c6f8ceded56750bd2dc4cd3fe4db55966 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 6 Jan 2017 13:09:39 +0100 Subject: [PATCH] gendepend improvements; refs #5144 --- compiler/depends.nim | 2 +- compiler/main.nim | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/depends.nim b/compiler/depends.nim index 9087f89f26..e8c295a349 100644 --- a/compiler/depends.nim +++ b/compiler/depends.nim @@ -24,7 +24,7 @@ type var gDotGraph: Rope # the generated DOT file; we need a global variable 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]"]; proc addDotDependency(c: PPassContext, n: PNode): PNode = diff --git a/compiler/main.nim b/compiler/main.nim index f13375948c..e6563f281c 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -31,11 +31,19 @@ proc semanticPasses = registerPass verbosePass 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) = semanticPasses() registerPass(gendependPass) #registerPass(cleanupPass) compileProject(graph, cache) + writeDepsFile(graph, gProjectFull) generateDot(gProjectFull) execExternalProgram("dot -Tpng -o" & changeFileExt(gProjectFull, "png") & ' ' & changeFileExt(gProjectFull, "dot"))