Fix nimconf path to nim

This commit is contained in:
Ganesh Viswanathan 2020-05-20 16:58:52 -05:00
commit 80cfc99dcd
5 changed files with 15 additions and 10 deletions

View file

@ -139,7 +139,7 @@ proc newConstDef(gState: State, node: TSNode, fname = "", fval = ""): PNode =
else:
gecho &"# const '{origname}' is duplicate, skipped"
else:
gecho &"# const '{origname}' has unsupported value '{val}'"
gecho &"# const '{origname}' has unsupported value '{val.strip()}'"
gState.skippedSyms.incl origname
proc addConst(gState: State, node: TSNode) =

View file

@ -15,6 +15,7 @@ type
var
gDebug* = false
gDebugCT* {.compileTime.} = false
gNimExe* = ""
proc echoDebug(str: string) =
let str = "\n# " & str.strip().replace("\n", "\n# ")
@ -46,6 +47,14 @@ proc sanitizePath*(path: string, noQuote = false, sep = $DirSep): string =
if not noQuote:
result = result.quoteShell
proc getCurrentNimCompiler*(): string =
when nimvm:
result = getCurrentCompilerExe()
when defined(nimsuggest):
result = result.replace("nimsuggest", "nim")
else:
result = gNimExe
# Nim cfg file related functionality
include "."/nimconf
@ -64,11 +73,6 @@ proc getNimteropCacheDir(): string =
# Get location to cache all nimterop artifacts
result = getNimcacheDir() / "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

@ -454,7 +454,7 @@ proc loadPlugin*(gState: State, sourcePath: string) =
outflags = &"--out:\"{pdll}\""
# Compile plugin as library with `markAndSweep` GC
cmd = &"{gState.nim.sanitizePath} c --app:lib --gc:markAndSweep {flags} {outflags} {sourcePath.sanitizePath}"
cmd = &"{gState.nim} c --app:lib --gc:markAndSweep {flags} {outflags} {sourcePath.sanitizePath}"
discard execAction(cmd)
doAssert fileExists(pdll), "No plugin binary generated for " & sourcePath

View file

@ -20,7 +20,7 @@ type
proc getJson(projectDir: string): JsonNode =
# Get `nim dump` json value for `projectDir`
var
cmd = "nim --hints:off --dump.format:json dump dummy"
cmd = &"{getCurrentNimCompiler()} --hints:off --dump.format:json dump dummy"
dump = ""
ret = 0

View file

@ -64,7 +64,7 @@ proc main(
feature: feature,
includeDirs: includeDirs,
mode: mode,
nim: nim,
nim: nim.sanitizePath,
noComments: noComments,
noHeader: noHeader,
past: past,
@ -79,7 +79,8 @@ proc main(
)
# Set gDebug in build.nim
build.gDebug = debug
build.gDebug = gState.debug
build.gNimExe = gState.nim
# Default `ast` mode
if gState.feature.Bl: