compiler/[main,docgen]: don't put generated doc in subfolder (#10754)

* compiler/[main,docgen]: don't put generated doc in subfolder

Fixes regression caused by ca4b971bc8.

foo.nim will now generates foo.html instead of foo/foo.html

* compiler/[main,docgen]: map -o to -outdir for project

This reinstantiate the old behavior of -o for project-wide docgen
This commit is contained in:
alaviss 2019-02-28 20:46:35 +07:00 • committed by Miran
commit 1b542e7320
2 changed files with 6 additions and 2 deletions

View file

@ -992,7 +992,9 @@ proc writeOutputJson*(d: PDoc, useWarning = false) =
"\" for writing") "\" for writing")
proc commandDoc*(cache: IdentCache, conf: ConfigRef) = proc commandDoc*(cache: IdentCache, conf: ConfigRef) =
conf.outDir = AbsoluteDir(conf.outDir / conf.outFile) if optWholeProject in conf.globalOptions:
# Backward compatibility with previous versions
conf.outDir = AbsoluteDir(conf.outDir / conf.outFile)
var ast = parseFile(conf.projectMainIdx, cache, conf) var ast = parseFile(conf.projectMainIdx, cache, conf)
if ast == nil: return if ast == nil: return
var d = newDocumentor(conf.projectFull, cache, conf) var d = newDocumentor(conf.projectFull, cache, conf)

View file

@ -63,7 +63,9 @@ proc commandCheck(graph: ModuleGraph) =
when not defined(leanCompiler): when not defined(leanCompiler):
proc commandDoc2(graph: ModuleGraph; json: bool) = proc commandDoc2(graph: ModuleGraph; json: bool) =
graph.config.outDir = AbsoluteDir(graph.config.outDir / graph.config.outFile) if optWholeProject in graph.config.globalOptions:
# Backward compatibility with previous versions
graph.config.outDir = AbsoluteDir(graph.config.outDir / graph.config.outFile)
graph.config.errorMax = high(int) # do not stop after first error graph.config.errorMax = high(int) # do not stop after first error
semanticPasses(graph) semanticPasses(graph)
if json: registerPass(graph, docgen2JsonPass) if json: registerPass(graph, docgen2JsonPass)