Usability fixes and output improvements for compile command.
This commit is contained in:
parent
cb1248a9b4
commit
971dc300bb
2 changed files with 13 additions and 7 deletions
|
|
@ -635,6 +635,13 @@ proc build(options: Options) =
|
|||
buildFromDir(pkgInfo, paths, false)
|
||||
|
||||
proc compile(options: Options) =
|
||||
let bin = options.action.file
|
||||
if bin == "":
|
||||
raise newException(NimbleError, "You need to specify a file to compile.")
|
||||
|
||||
if not fileExists(bin):
|
||||
raise newException(NimbleError, "Specified file does not exist.")
|
||||
|
||||
var pkgInfo = getPkgInfo(getCurrentDir(), options)
|
||||
nimScriptHint(pkgInfo)
|
||||
let paths = processDeps(pkginfo, options)
|
||||
|
|
@ -644,20 +651,18 @@ proc compile(options: Options) =
|
|||
for option in options.action.compileOptions:
|
||||
args.add(option & " ")
|
||||
|
||||
let bin = options.action.file
|
||||
|
||||
let backend =
|
||||
if options.action.backend.len > 0:
|
||||
options.action.backend
|
||||
else:
|
||||
pkgInfo.backend
|
||||
|
||||
if bin == "":
|
||||
raise newException(NimbleError, "You need to specify a file to compile.")
|
||||
|
||||
display("Compiling", "$1 ($2) using $3 backend" % [bin, pkgInfo.name, backend],
|
||||
priority = HighPriority)
|
||||
display("Compiling", "$1 (from package $2) using $3 backend" %
|
||||
[bin, pkgInfo.name, backend], priority = HighPriority)
|
||||
doCmd("\"" & getNimBin() & "\" $# --noBabelPath $# \"$#\"" %
|
||||
[backend, args, bin])
|
||||
display("Success:", "Compilation finished", Success, HighPriority)
|
||||
|
||||
proc search(options: Options) =
|
||||
## Searches for matches in ``options.action.search``.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ proc doCmd*(cmd: string) =
|
|||
|
||||
if exitCode != QuitSuccess:
|
||||
raise newException(NimbleError,
|
||||
"Execution failed with exit code " & $exitCode)
|
||||
"Execution failed with exit code $1\nCommand: $2\nOutput: $3" %
|
||||
[$exitCode, cmd, output])
|
||||
|
||||
proc doCmdEx*(cmd: string): tuple[output: TaintedString, exitCode: int] =
|
||||
let bin = extractBin(cmd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue