summary refs log tree commit diff stats
path: root/compiler/extccomp.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/extccomp.nim')
-rw-r--r--compiler/extccomp.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 4ecad6d58..011252fe4 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -949,6 +949,8 @@ proc callCCompiler*(conf: ConfigRef) =
 #from json import escapeJson
 import json, std / sha1
 
+template hashNimExe(): string = $secureHashFile(os.getAppFilename())
+
 proc writeJsonBuildInstructions*(conf: ConfigRef) =
   template lit(x: untyped) = f.write x
   template str(x: untyped) =
@@ -1028,7 +1030,9 @@ proc writeJsonBuildInstructions*(conf: ConfigRef) =
       str conf.commandLine
       lit ",\L\"nimfiles\":[\L"
       nimfiles(conf, f)
-      lit "]\L"
+      lit "],\L\"nimexe\": \L"
+      str hashNimExe()
+      lit "\L"
 
     lit "\L}\L"
     close(f)
@@ -1045,6 +1049,8 @@ proc changeDetectedViaJsonBuildInstructions*(conf: ConfigRef; projectfile: Absol
     let oldCmdLine = data["cmdline"].getStr
     if conf.commandLine != oldCmdLine:
       return true
+    if hashNimExe() != data["nimexe"].getStr:
+      return true
     let nimfilesPairs = data["nimfiles"]
     doAssert nimfilesPairs.kind == JArray
     for p in nimfilesPairs: