simplify extccomp.nim json logic via jsonutils; fix #18084 (#18100)

* simplify extccomp.nim json logic via jsonutils
* fix #18084
* simplify further
* workaround for bootstrap that can be removed after updating csources_v1 >= 1.2
This commit is contained in:
Timothee Cour 2021-06-03 13:29:45 -07:00 • committed by GitHub
commit 654a20166e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 190 deletions

View file

@ -240,13 +240,10 @@ proc getSystemConfigPath*(conf: ConfigRef; filename: RelativeFile): AbsoluteFile
proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen: IdGenerator) =
setDefaultLibpath(conf)
var configFiles = newSeq[AbsoluteFile]()
template readConfigFile(path) =
let configPath = path
if readConfigFile(configPath, cache, conf):
configFiles.add(configPath)
conf.configFiles.add(configPath)
template runNimScriptIfExists(path: AbsoluteFile, isMain = false) =
let p = path # eval once
@ -256,7 +253,7 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
elif conf.projectIsCmd: s = llStreamOpen(conf.cmdInput)
if s == nil and fileExists(p): s = llStreamOpen(p, fmRead)
if s != nil:
configFiles.add(p)
conf.configFiles.add(p)
runNimScript(cache, p, idgen, freshDefines = false, conf, s)
if optSkipSystemConfigFile notin conf.globalOptions:
@ -295,12 +292,12 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
let scriptFile = conf.projectFull.changeFileExt("nims")
let scriptIsProj = scriptFile == conf.projectFull
template showHintConf =
for filename in configFiles:
for filename in conf.configFiles:
# delayed to here so that `hintConf` is honored
rawMessage(conf, hintConf, filename.string)
if conf.cmd == cmdNimscript:
showHintConf()
configFiles.setLen 0
conf.configFiles.setLen 0
if conf.cmd != cmdIdeTools:
if conf.cmd == cmdNimscript:
runNimScriptIfExists(conf.projectFull, isMain = true)