diff options
Diffstat (limited to 'compiler/nimpaths.nim')
-rw-r--r-- | compiler/nimpaths.nim | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/compiler/nimpaths.nim b/compiler/nimpaths.nim index 9caaf4f05..0a66c3c1f 100644 --- a/compiler/nimpaths.nim +++ b/compiler/nimpaths.nim @@ -3,12 +3,13 @@ Represents absolute paths, but using a symbolic variables (eg $nimr) which can b resolved at runtime; this avoids hardcoding at compile time absolute paths so that the project root can be relocated. -xxx consider some refactoring with $nim/testament/lib/stdtest/specialpaths.nim; +xxx factor pending https://github.com/timotheecour/Nim/issues/616, see also +$nim/testament/lib/stdtest/specialpaths.nim specialpaths is simpler because it doesn't need variables to be relocatable at runtime (eg for use in testament) interpolation variables: - $nimr: such that `$nimr/lib/system.nim` exists (avoids confusion with $nim binary) +: $nimr: such that `$nimr/lib/system.nim` exists (avoids confusion with $nim binary) in compiler, it's obtainable via getPrefixDir(); for other tools (eg koch), this could be getCurrentDir() or getAppFilename().parentDir.parentDir, depending on use case @@ -16,15 +17,21 @@ interpolation variables: Unstable API ]## -import std/[os,strutils] +import std/[os, strutils] + +when defined(nimPreviewSlimSystem): + import std/assertions + const docCss* = "$nimr/doc/nimdoc.css" + docCls* = "$nimr/doc/nimdoc.cls" docHackNim* = "$nimr/tools/dochack/dochack.nim" docHackJs* = docHackNim.changeFileExt("js") docHackJsFname* = docHackJs.lastPathPart theindexFname* = "theindex.html" nimdocOutCss* = "nimdoc.out.css" + nimdocOutCls* = "nimdoc.cls" # `out` to make it easier to use with gitignore in user's repos htmldocsDirname* = "htmldocs" dotdotMangle* = "_._" ## refs #13223 @@ -36,11 +43,11 @@ proc interp*(path: string, nimr: string): string = doAssert '$' notin result, $(path, nimr, result) # avoids un-interpolated variables in output proc getDocHacksJs*(nimr: string, nim = getCurrentCompilerExe(), forceRebuild = false): string = - ## return absolute path to dochhack.js, rebuilding if it doesn't exist or if + ## return absolute path to dochack.js, rebuilding if it doesn't exist or if ## `forceRebuild`. let docHackJs2 = docHackJs.interp(nimr = nimr) if forceRebuild or not docHackJs2.fileExists: - let cmd = "$nim js $file" % ["nim", nim.quoteShell, "file", docHackNim.interp(nimr = nimr).quoteShell] + let cmd = "$nim js -d:release $file" % ["nim", nim.quoteShell, "file", docHackNim.interp(nimr = nimr).quoteShell] echo "getDocHacksJs: cmd: " & cmd doAssert execShellCmd(cmd) == 0, $(cmd) doAssert docHackJs2.fileExists |