Fix nimsuggest caching
This commit is contained in:
parent
53cb044257
commit
1cfcceddb4
3 changed files with 9 additions and 4 deletions
|
|
@ -29,6 +29,11 @@ proc getOsCacheDir(): string =
|
||||||
proc getNimteropCacheDir(): string =
|
proc getNimteropCacheDir(): string =
|
||||||
result = getOsCacheDir() / "nimterop"
|
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,
|
proc execAction*(cmd: string, retry = 0, die = true, cache = false,
|
||||||
cacheKey = ""): tuple[output: string, ret: int] =
|
cacheKey = ""): tuple[output: string, ret: int] =
|
||||||
## Execute an external command - supported at compile time
|
## Execute an external command - supported at compile time
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ proc getNimCheckError(output: string): tuple[tmpFile, errors: string] =
|
||||||
|
|
||||||
let
|
let
|
||||||
(check, _) = execAction(
|
(check, _) = execAction(
|
||||||
&"{getCurrentCompilerExe()} check {result.tmpFile.sanitizePath}",
|
&"{getCurrentNimCompiler()} check {result.tmpFile.sanitizePath}",
|
||||||
die = false
|
die = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -153,7 +153,7 @@ proc getToast(fullpath: string, recurse: bool = false, dynlib: string = "",
|
||||||
if gStateCT.symOverride.nBl:
|
if gStateCT.symOverride.nBl:
|
||||||
cmd.add &" --symOverride={gStateCT.symOverride.join(\",\")}"
|
cmd.add &" --symOverride={gStateCT.symOverride.join(\",\")}"
|
||||||
|
|
||||||
cmd.add &" --nim:{getCurrentCompilerExe().sanitizePath}"
|
cmd.add &" --nim:{getCurrentNimCompiler().sanitizePath}"
|
||||||
|
|
||||||
if gStateCT.pluginSourcePath.nBl:
|
if gStateCT.pluginSourcePath.nBl:
|
||||||
cmd.add &" --pluginSourcePath={gStateCT.pluginSourcePath.sanitizePath}"
|
cmd.add &" --pluginSourcePath={gStateCT.pluginSourcePath.sanitizePath}"
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ proc main(
|
||||||
if gState.pnim and check:
|
if gState.pnim and check:
|
||||||
# Run nim check on generated wrapper
|
# Run nim check on generated wrapper
|
||||||
var
|
var
|
||||||
(check, err) = execCmdEx(&"{getCurrentCompilerExe()} check {outputFile}")
|
(check, err) = execCmdEx(&"{gState.nim} check {outputFile}")
|
||||||
if err != 0:
|
if err != 0:
|
||||||
# Failed check so try stubbing
|
# Failed check so try stubbing
|
||||||
if stub:
|
if stub:
|
||||||
|
|
@ -233,7 +233,7 @@ proc main(
|
||||||
outputFile.writeFile(data)
|
outputFile.writeFile(data)
|
||||||
|
|
||||||
# Rerun nim check on stubbed wrapper
|
# 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
|
doAssert err == 0, "# Nim check with stub failed:\n\n" & check
|
||||||
else:
|
else:
|
||||||
doAssert err == 0, "# Nim check failed:\n\n" & check
|
doAssert err == 0, "# Nim check failed:\n\n" & check
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue