summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-03-19 02:39:18 -0700
committerGitHub <noreply@github.com>2020-03-19 10:39:18 +0100
commit1f2042411a5343ad8bbdc8d2b1a75ce4f866a04c (patch)
tree8d9f5498113dc1c63dc56b667c86d06773deeb7b
parenta17e87b516a075a04e3d27c55b9314090abf5bae (diff)
downloadNim-1f2042411a5343ad8bbdc8d2b1a75ce4f866a04c.tar.gz
fix #13412 nim now recompiles for stdin input; SuccessX now configurable; can show whether it recompiled (#13506)
* fix #13412 nim now recompiles for stdin input; SuccessX now indicates whether it recompiled
-rw-r--r--compiler/extccomp.nim10
-rw-r--r--compiler/lineinfos.nim2
2 files changed, 11 insertions, 1 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index ee921f4e1..5fc532cd8 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -1064,6 +1064,9 @@ proc writeJsonBuildInstructions*(conf: ConfigRef) =
     lit ",\L\"extraCmds\": "
     lit $(%* conf.extraCmds)
 
+    lit ",\L\"stdinInput\": "
+    lit $(%* conf.projectIsStdin)
+
     if optRun in conf.globalOptions or isDefined(conf, "nimBetterRun"):
       lit ",\L\"cmdline\": "
       str conf.commandLine
@@ -1090,6 +1093,13 @@ proc changeDetectedViaJsonBuildInstructions*(conf: ConfigRef; projectfile: Absol
       return true
     if hashNimExe() != data["nimexe"].getStr:
       return true
+    if not data.hasKey("stdinInput"): return true
+    let stdinInput = data["stdinInput"].getBool
+    if conf.projectIsStdin or stdinInput:
+      # could optimize by returning false if stdin input was the same,
+      # but I'm not sure how to get full stding input
+      return true
+
     let depfilesPairs = data["depfiles"]
     doAssert depfilesPairs.kind == JArray
     for p in depfilesPairs:
diff --git a/compiler/lineinfos.nim b/compiler/lineinfos.nim
index 033a98513..680b193f9 100644
--- a/compiler/lineinfos.nim
+++ b/compiler/lineinfos.nim
@@ -101,7 +101,7 @@ const
     warnCycleCreated: "$1",
     warnUser: "$1",
     hintSuccess: "operation successful: $#",
-    # keep in sync with `pegSuccess` see testament.nim
+    # keep in sync with `testament.isSuccess`
     hintSuccessX: "$loc LOC; $sec sec; $mem; $build build; proj: $project; out: $output",
     hintCC: "CC: $1",
     hintLineTooLong: "line too long",