aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2019-12-23 13:38:21 -0600
committerGanesh Viswanathan <dev@genotrance.com>2019-12-23 13:38:21 -0600
commit1cfcceddb4eb213daf7d190081336e72306a9f45 (patch)
tree75af2f6f91b0c44d232df37286536aa1dc188d2d
parent53cb044257bf8857caff3d5cbdfb06b6e43fd400 (diff)
downloadnimterop-1cfcceddb4eb213daf7d190081336e72306a9f45.tar.gz
nimterop-1cfcceddb4eb213daf7d190081336e72306a9f45.zip
Fix nimsuggest caching
-rw-r--r--nimterop/build.nim5
-rw-r--r--nimterop/cimport.nim4
-rw-r--r--nimterop/toast.nim4
3 files changed, 9 insertions, 4 deletions
diff --git a/nimterop/build.nim b/nimterop/build.nim
index bd0a0b1..69cbe95 100644
--- a/nimterop/build.nim
+++ b/nimterop/build.nim
@@ -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
diff --git a/nimterop/cimport.nim b/nimterop/cimport.nim
index 6b2d153..4c63c31 100644
--- a/nimterop/cimport.nim
+++ b/nimterop/cimport.nim
@@ -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}"
diff --git a/nimterop/toast.nim b/nimterop/toast.nim
index 5923e56..c26b460 100644
--- a/nimterop/toast.nim
+++ b/nimterop/toast.nim
@@ -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