3131 strutils,
3232 osproc,
3333 sha1,
34- streams,
3534 sequtils,
3635 times,
3736 strtabs,
@@ -296,10 +295,10 @@ const
296295
297296 hExt* = " .h"
298297
299- template writePrettyCmdsStderr (cmd) =
300- if cmd.len > 0 :
301- flushDot (conf)
302- stderr. writeLine (cmd)
298+ template writePrettyCmds (cmd: CmdReport ) =
299+ if cmd.msg. len > 0 :
300+ # TODO : don't use `localReport`. Log the message/diagnostic directly
301+ conf. localReport (cmd)
303302
304303proc nameToCC * (name: string ): TSystemCC =
305304 # # Returns the kind of compiler referred to by `name`, or ccNone
@@ -813,12 +812,19 @@ proc linkViaResponseFile(conf: ConfigRef; cmd: string) =
813812 finally :
814813 removeFile (linkerArgs)
815814
816- proc displayProgressCC (conf: ConfigRef , path, compileCmd: string ): string =
815+ proc displayProgressCC (conf: ConfigRef , path, compileCmd: string ): CmdReport =
817816 if conf.hasHint (rcmdCompiling):
818- conf. localReport CmdReport (
817+ CmdReport (
819818 kind: rcmdCompiling,
820- cmd: compileCmd,
821- msg: demanglePackageName (path.splitFile.name))
819+ msg: demanglePackageName (path.splitFile.name),
820+ cmd:
821+ (if optListCmd in conf.globalOptions or
822+ conf.verbosity > compVerbosityDefault:
823+ compileCmd
824+ else :
825+ " " ))
826+ else :
827+ CmdReport (kind: rcmdCompiling) # empty report
822828
823829proc callCCompiler * (conf: ConfigRef ) =
824830 var
@@ -830,8 +836,8 @@ proc callCCompiler*(conf: ConfigRef) =
830836 # var c = cCompiler
831837 var script = " "
832838 var cmds: TStringSeq
833- var prettyCmds: TStringSeq
834- let prettyCb = proc (idx: int ) = writePrettyCmdsStderr (prettyCmds[idx])
839+ var prettyCmds: seq [ CmdReport ]
840+ let prettyCb = proc (idx: int ) = writePrettyCmds (prettyCmds[idx])
835841
836842 for idx, it in conf.toCompile:
837843 # call the C compiler for the .c file:
@@ -969,8 +975,9 @@ proc runJsonBuildInstructions*(conf: ConfigRef; jsonFile: AbsoluteFile) =
969975 kind: rbackJsonScriptMismatch,
970976 jsonScriptParams: (outputCurrent, output, jsonFile.string ))
971977
972- var cmds, prettyCmds: TStringSeq
973- let prettyCb = proc (idx: int ) = writePrettyCmdsStderr (prettyCmds[idx])
978+ var cmds: TStringSeq
979+ var prettyCmds: seq [CmdReport ]
980+ let prettyCb = proc (idx: int ) = writePrettyCmds (prettyCmds[idx])
974981 for (name, cmd) in bcache.compile:
975982 cmds.add cmd
976983 prettyCmds.add displayProgressCC (conf, name, cmd)
0 commit comments