compiler: minor refactoring (#16633)
This commit is contained in:
parent
596da7f9a0
commit
add1ccb6cb
1 changed files with 11 additions and 12 deletions
|
|
@ -211,18 +211,17 @@ proc mainCommand*(graph: ModuleGraph) =
|
||||||
defineSymbol(conf.symbols, "nimdoc")
|
defineSymbol(conf.symbols, "nimdoc")
|
||||||
body
|
body
|
||||||
|
|
||||||
block: ## command prepass
|
## command prepass
|
||||||
if conf.cmd == cmdCrun: conf.globalOptions.incl {optRun, optUseNimcache}
|
if conf.cmd == cmdCrun: conf.globalOptions.incl {optRun, optUseNimcache}
|
||||||
if conf.cmd notin cmdBackends + {cmdTcc}: customizeForBackend(backendC)
|
if conf.cmd notin cmdBackends + {cmdTcc}: customizeForBackend(backendC)
|
||||||
if conf.outDir.isEmpty:
|
if conf.outDir.isEmpty:
|
||||||
# doc like commands can generate a lot of files (especially with --project)
|
# doc like commands can generate a lot of files (especially with --project)
|
||||||
# so by default should not end up in $PWD nor in $projectPath.
|
# so by default should not end up in $PWD nor in $projectPath.
|
||||||
conf.outDir = block:
|
var ret = if optUseNimcache in conf.globalOptions: getNimcacheDir(conf)
|
||||||
var ret = if optUseNimcache in conf.globalOptions: getNimcacheDir(conf)
|
else: conf.projectPath
|
||||||
else: conf.projectPath
|
doAssert ret.string.isAbsolute # `AbsoluteDir` is not a real guarantee
|
||||||
doAssert ret.string.isAbsolute # `AbsoluteDir` is not a real guarantee
|
if conf.cmd in cmdDocLike + {cmdRst2html, cmdRst2tex}: ret = ret / htmldocsDir
|
||||||
if conf.cmd in cmdDocLike + {cmdRst2html, cmdRst2tex}: ret = ret / htmldocsDir
|
conf.outDir = ret
|
||||||
ret
|
|
||||||
|
|
||||||
## process all commands
|
## process all commands
|
||||||
case conf.cmd
|
case conf.cmd
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue