make SuccessX show project file + output file (#13043)

* make SuccessX show project file + output file
* address comments
* fix test and add `result.err = reNimcCrash` otherwise hard to see where reNimcCrash used
* address comments
This commit is contained in:
Timothee Cour 2020-01-07 15:39:07 -08:00 • committed by Andreas Rumpf
commit 15043d35b8
4 changed files with 29 additions and 14 deletions

View file

@ -97,7 +97,8 @@ const
warnCycleCreated: "$1",
warnUser: "$1",
hintSuccess: "operation successful: $#",
hintSuccessX: "operation successful ($# lines compiled; $# sec total; $#; $#)",
# keep in sync with `pegSuccess` see testament.nim
hintSuccessX: "$loc LOC; $sec sec; $mem; $build build; $project proj; $output out",
hintCC: "CC: \'$1\'", # unused
hintLineTooLong: "line too long",
hintXDeclaredButNotUsed: "'$1' is declared but not used",

View file

@ -355,16 +355,24 @@ proc mainCommand*(graph: ModuleGraph) =
if conf.errorCounter == 0 and
conf.cmd notin {cmdInterpret, cmdRun, cmdDump}:
when declared(system.getMaxMem):
let usedMem = formatSize(getMaxMem()) & " peakmem"
else:
let usedMem = formatSize(getTotalMem())
rawMessage(conf, hintSuccessX, [$conf.linesCompiled,
formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3),
usedMem,
if isDefined(conf, "danger"): "Dangerous Release Build"
elif isDefined(conf, "release"): "Release Build"
else: "Debug Build"])
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"
elif isDefined(conf, "release"): "Release"
else: "Debug"
let sec = formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3)
let project = if optListFullPaths in conf.globalOptions: $conf.projectFull else: $conf.projectName
let output = if optListFullPaths in conf.globalOptions: $conf.getOutFileFull else: $conf.outFile
rawMessage(conf, hintSuccessX, [
"loc", loc,
"sec", sec,
"mem", mem,
"build", build,
"project", project,
"output", output,
])
when PrintRopeCacheStats:
echo "rope cache stats: "

View file

@ -284,6 +284,8 @@ type
severity: Severity) {.closure, gcsafe.}
cppCustomNamespace*: string
proc getOutFileFull*(a: ConfigRef): AbsoluteFile = a.outDir / a.outFile
proc hcrOn*(conf: ConfigRef): bool = return optHotCodeReloading in conf.globalOptions
template depConfigFields*(fn) {.dirty.} =