summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPaul Tan <pyokagan@gmail.com>2017-08-22 23:36:03 +0800
committerPaul Tan <pyokagan@gmail.com>2017-08-25 17:45:33 +0800
commitb06c0f97a4640c16b2205635b378a39fcef9b814 (patch)
treee903eca265db9211261c8783f5267cb41d50af76
parent1a50442c13bfc19fe314df0a0fec87dd1b3c5d48 (diff)
downloadNim-b06c0f97a4640c16b2205635b378a39fcef9b814.tar.gz
writeDepsFile: write included files as well
`writeDepsFile()` does not list files which were included with the
`include` statement, e.g, with:

    import file1
    include file2

`file1` will be written to the deps file, while `file2` would not.

Fix this by modifying `writeDepsFile()` to write included files as well.
Now, both `file1` and `file2` in the above example will be written to
the deps file.
-rw-r--r--compiler/main.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index 76e18a80b..994c28ccb 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -16,7 +16,7 @@ import
   cgen, jsgen, json, nversion,
   platform, nimconf, importer, passaux, depends, vm, vmdef, types, idgen,
   docgen2, service, parser, modules, ccgutils, sigmatch, ropes,
-  modulegraphs
+  modulegraphs, tables
 
 from magicsys import systemModule, resetSysTypes
 
@@ -36,6 +36,9 @@ proc writeDepsFile(g: ModuleGraph; project: string) =
   for m in g.modules:
     if m != nil:
       f.writeLine(toFullPath(m.position.int32))
+  for k in g.inclToMod.keys:
+    if g.getModule(k).isNil:  # don't repeat includes which are also modules
+      f.writeLine(k.toFullPath)
   f.close()
 
 proc commandGenDepend(graph: ModuleGraph; cache: IdentCache) =