nim doc --backend:js, nim doc --doccmd:-d:foo, nim r --backend:js, --doccmd:skip + other improvements (#14278)
* `nim doc --backend:js|cpp...` `nim doc --doccmd:'-d:foo --threads:on'` `nim r --backend:cpp...` (implies --run --usenimcache) * --usenimcache works with all targets * --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
This commit is contained in:
parent
d11cb9d495
commit
9502e39b63
22 changed files with 213 additions and 99 deletions
|
|
@ -307,14 +307,12 @@ proc getConfigVar(conf: ConfigRef; c: TSystemCC, suffix: string): string =
|
|||
# use ``cpu.os.cc`` for cross compilation, unless ``--compileOnly`` is given
|
||||
# for niminst support
|
||||
let fullSuffix =
|
||||
if conf.cmd == cmdCompileToCpp:
|
||||
".cpp" & suffix
|
||||
elif conf.cmd == cmdCompileToOC:
|
||||
".objc" & suffix
|
||||
elif conf.cmd == cmdCompileToJS:
|
||||
".js" & suffix
|
||||
case conf.backend
|
||||
of backendCpp, backendJs, backendObjc: "." & $conf.backend & suffix
|
||||
of backendC: suffix
|
||||
else:
|
||||
suffix
|
||||
doAssert false
|
||||
""
|
||||
|
||||
if (conf.target.hostOS != conf.target.targetOS or conf.target.hostCPU != conf.target.targetCPU) and
|
||||
optCompileOnly notin conf.globalOptions:
|
||||
|
|
@ -481,10 +479,10 @@ proc needsExeExt(conf: ConfigRef): bool {.inline.} =
|
|||
(conf.target.hostOS == osWindows)
|
||||
|
||||
proc useCpp(conf: ConfigRef; cfile: AbsoluteFile): bool =
|
||||
conf.cmd == cmdCompileToCpp and not cfile.string.endsWith(".c")
|
||||
conf.backend == backendCpp and not cfile.string.endsWith(".c")
|
||||
|
||||
proc envFlags(conf: ConfigRef): string =
|
||||
result = if conf.cmd == cmdCompileToCpp:
|
||||
result = if conf.backend == backendCpp:
|
||||
getEnv("CXXFLAGS")
|
||||
else:
|
||||
getEnv("CFLAGS")
|
||||
|
|
@ -535,7 +533,7 @@ proc ccHasSaneOverflow*(conf: ConfigRef): bool =
|
|||
|
||||
proc getLinkerExe(conf: ConfigRef; compiler: TSystemCC): string =
|
||||
result = if CC[compiler].linkerExe.len > 0: CC[compiler].linkerExe
|
||||
elif optMixedMode in conf.globalOptions and conf.cmd != cmdCompileToCpp: CC[compiler].cppCompiler
|
||||
elif optMixedMode in conf.globalOptions and conf.backend != backendCpp: CC[compiler].cppCompiler
|
||||
else: getCompilerExe(conf, compiler, AbsoluteFile"")
|
||||
|
||||
proc getCompileCFileCmd*(conf: ConfigRef; cfile: Cfile,
|
||||
|
|
@ -626,8 +624,10 @@ proc footprint(conf: ConfigRef; cfile: Cfile): SecureHash =
|
|||
getCompileCFileCmd(conf, cfile))
|
||||
|
||||
proc externalFileChanged(conf: ConfigRef; cfile: Cfile): bool =
|
||||
if conf.cmd notin {cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdCompileToLLVM, cmdNone}:
|
||||
return false
|
||||
case conf.backend
|
||||
of backendInvalid: doAssert false
|
||||
of backendJs: return false # pre-existing behavior, but not sure it's good
|
||||
else: discard
|
||||
|
||||
var hashFile = toGeneratedFile(conf, conf.withPackageName(cfile.cname), "sha1")
|
||||
var currentHash = footprint(conf, cfile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue