Fix nimsuggest caching

This commit is contained in:
Ganesh Viswanathan 2019-12-23 13:38:21 -06:00
commit 1cfcceddb4
3 changed files with 9 additions and 4 deletions

View file

@ -29,6 +29,11 @@ proc getOsCacheDir(): string =
proc getNimteropCacheDir(): string =
result = getOsCacheDir() / "nimterop"
proc getCurrentNimCompiler*(): string =
result = getCurrentCompilerExe()
when defined(nimsuggest):
result = result.replace("nimsuggest", "nim")
proc execAction*(cmd: string, retry = 0, die = true, cache = false,
cacheKey = ""): tuple[output: string, ret: int] =
## Execute an external command - supported at compile time

View file

@ -115,7 +115,7 @@ proc getNimCheckError(output: string): tuple[tmpFile, errors: string] =
let
(check, _) = execAction(
&"{getCurrentCompilerExe()} check {result.tmpFile.sanitizePath}",
&"{getCurrentNimCompiler()} check {result.tmpFile.sanitizePath}",
die = false
)
@ -153,7 +153,7 @@ proc getToast(fullpath: string, recurse: bool = false, dynlib: string = "",
if gStateCT.symOverride.nBl:
cmd.add &" --symOverride={gStateCT.symOverride.join(\",\")}"
cmd.add &" --nim:{getCurrentCompilerExe().sanitizePath}"
cmd.add &" --nim:{getCurrentNimCompiler().sanitizePath}"
if gStateCT.pluginSourcePath.nBl:
cmd.add &" --pluginSourcePath={gStateCT.pluginSourcePath.sanitizePath}"

View file

@ -198,7 +198,7 @@ proc main(
if gState.pnim and check:
# Run nim check on generated wrapper
var
(check, err) = execCmdEx(&"{getCurrentCompilerExe()} check {outputFile}")
(check, err) = execCmdEx(&"{gState.nim} check {outputFile}")
if err != 0:
# Failed check so try stubbing
if stub:
@ -233,7 +233,7 @@ proc main(
outputFile.writeFile(data)
# Rerun nim check on stubbed wrapper
(check, err) = execCmdEx(&"{getCurrentCompilerExe()} check {outputFile}")
(check, err) = execCmdEx(&"{gState.nim} check {outputFile}")
doAssert err == 0, "# Nim check with stub failed:\n\n" & check
else:
doAssert err == 0, "# Nim check failed:\n\n" & check