summary refs log tree commit diff stats
path: root/compiler/main.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-06-13 23:51:40 -0700
committerGitHub <noreply@github.com>2021-06-14 08:51:40 +0200
commite1e8af535ec195e5749dffa728add95770e5cbd7 (patch)
tree5ef4e35035e9b5647a47f252ebf78082dc71e5db /compiler/main.nim
parent065243dc5988fbfcbed8236e19a588b98d63b199 (diff)
downloadNim-e1e8af535ec195e5749dffa728add95770e5cbd7.tar.gz
merge BuildMode into SuccessX, remove code duplication w drnim, add useful info to successx, add gc to compilesettings (#18252)
* merge BuildMode into SuccessX, add more info

* refactor duplicated with drnim

* fixup

* address comment
Diffstat (limited to 'compiler/main.nim')
-rw-r--r--compiler/main.nim40
1 files changed, 6 insertions, 34 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index 71e549ab8..7824e8cb2 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -13,13 +13,14 @@ when not defined(nimcore):
   {.error: "nimcore MUST be defined for Nim's core tooling".}
 
 import
-  llstream, strutils, os, ast, lexer, syntaxes, options, msgs,
-  condsyms, times,
+  std/[strutils, os, times, tables, sha1, with, json],
+  llstream, ast, lexer, syntaxes, options, msgs,
+  condsyms,
   sem, idents, passes, extccomp,
-  cgen, json, nversion,
+  cgen, nversion,
   platform, nimconf, passaux, depends, vm,
   modules,
-  modulegraphs, tables, lineinfos, pathutils, vmprofiler, std/[sha1, with]
+  modulegraphs, lineinfos, pathutils, vmprofiler
 
 import ic / [cbackend, integrity, navigator]
 from ic / ic import rodViewer
@@ -387,38 +388,9 @@ proc mainCommand*(graph: ModuleGraph) =
     rawMessage(conf, errGenerated, "invalid command: " & conf.command)
 
   if conf.errorCounter == 0 and conf.cmd notin {cmdTcc, cmdDump, cmdNop}:
-    # D20210419T170230:here
-    let mem =
-      when declared(system.getMaxMem): formatSize(getMaxMem()) & " peakmem"
-      else: formatSize(getTotalMem()) & " totmem"
-    let loc = $conf.linesCompiled
-    let build = if isDefined(conf, "danger"): "Dangerous Release build"
-                elif isDefined(conf, "release"): "Release build"
-                else: "***SLOW, DEBUG BUILD***; -d:release makes code run faster."
-    let sec = formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3)
-    let project = if conf.filenameOption == foAbs: $conf.projectFull else: $conf.projectName
-      # xxx honor conf.filenameOption more accurately
-    var output: string
-    if optCompileOnly in conf.globalOptions and conf.cmd != cmdJsonscript:
-      output = $conf.jsonBuildFile
-    elif conf.outFile.isEmpty and conf.cmd notin {cmdJsonscript} + cmdDocLike + cmdBackends:
-      # for some cmd we expect a valid absOutFile
-      output = "unknownOutput"
-    else:
-      output = $conf.absOutFile
-    if conf.filenameOption != foAbs: output = output.AbsoluteFile.extractFilename
-      # xxx honor filenameOption more accurately
     if optProfileVM in conf.globalOptions:
       echo conf.dump(conf.vmProfileData)
-    rawMessage(conf, hintSuccessX, [
-      "loc", loc,
-      "sec", sec,
-      "mem", mem,
-      "project", project,
-      "output", output,
-      ])
-    if conf.cmd in cmdBackends:
-      rawMessage(conf, hintBuildMode, build)
+    genSuccessX(conf)
 
   when PrintRopeCacheStats:
     echo "rope cache stats: "