[wip]better hint message for JS (#18704)

* better hint message for JS

* both
This commit is contained in:
flywind 2021-08-18 21:53:52 +08:00 • committed by GitHub
commit 0778a38bbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -669,17 +669,28 @@ proc genSuccessX*(conf: ConfigRef) =
else: formatSize(getTotalMem()) & " totmem" else: formatSize(getTotalMem()) & " totmem"
let loc = $conf.linesCompiled let loc = $conf.linesCompiled
var build = "" var build = ""
var flags = ""
const debugModeHints = "none (DEBUG BUILD, `-d:release` generates faster code)"
if conf.cmd in cmdBackends: if conf.cmd in cmdBackends:
build.add "gc: $#; " % $conf.selectedGC if conf.backend != backendJs:
if optThreads in conf.globalOptions: build.add "threads: on; " build.add "gc: $#; " % $conf.selectedGC
build.add "opt: " if optThreads in conf.globalOptions: build.add "threads: on; "
if optOptimizeSpeed in conf.options: build.add "speed" build.add "opt: "
elif optOptimizeSize in conf.options: build.add "size" if optOptimizeSpeed in conf.options: build.add "speed"
else: build.add "none (DEBUG BUILD, `-d:release` generates faster code)" elif optOptimizeSize in conf.options: build.add "size"
# pending https://github.com/timotheecour/Nim/issues/752, point to optimization.html else: build.add debugModeHints
var flags = "" # pending https://github.com/timotheecour/Nim/issues/752, point to optimization.html
if isDefined(conf, "danger"): flags.add " -d:danger" if isDefined(conf, "danger"): flags.add " -d:danger"
elif isDefined(conf, "release"): flags.add " -d:release" elif isDefined(conf, "release"): flags.add " -d:release"
else:
build.add "opt: "
if isDefined(conf, "danger"):
build.add "speed"
flags.add " -d:danger"
elif isDefined(conf, "release"):
build.add "speed"
flags.add " -d:release"
else: build.add debugModeHints
if flags.len > 0: build.add "; options:" & flags if flags.len > 0: build.add "; options:" & flags
let sec = formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3) let sec = formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3)
let project = if conf.filenameOption == foAbs: $conf.projectFull else: $conf.projectName let project = if conf.filenameOption == foAbs: $conf.projectFull else: $conf.projectName