summary refs log tree commit diff stats
path: root/tools
diff options
context:
space:
mode:
authorKaushal Modi <kaushal.modi@gmail.com>2018-09-28 13:12:28 -0400
committerKaushal Modi <kaushal.modi@gmail.com>2018-09-29 13:15:29 -0400
commit2e5c759736a9458b192a3beb2cf3a38b2f198887 (patch)
tree9678795f664c69a5827aa214820b8831cf8e3252 /tools
parent40e01d8549ce3c278dbe791d7af4f1e73b4d56da (diff)
downloadNim-2e5c759736a9458b192a3beb2cf3a38b2f198887.tar.gz
Make "koch docs" copy the dochack.js to the right location too
- Fixes https://github.com/nim-lang/Nim/issues/9104.
- Fixes https://github.com/nim-lang/Nim/issues/9095.

Expect dochack.js to be fetched from the doc/html/ dir instead of from
doc/.

Also remove an unused and unexported proc pathPart.
Diffstat (limited to 'tools')
-rw-r--r--tools/kochdocs.nim18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/kochdocs.nim b/tools/kochdocs.nim
index ed135f579..2a51a1c8e 100644
--- a/tools/kochdocs.nim
+++ b/tools/kochdocs.nim
@@ -7,8 +7,9 @@ const
 
   nimArgs = "--hint[Conf]:off --hint[Path]:off --hint[Processing]:off -d:boot --putenv:nimversion=$#" % system.NimVersion
   gitUrl = "https://github.com/nim-lang/Nim"
-  docHtmlOutput = "doc/html"
-  webUploadOutput = "web/upload"
+  docHtmlOutput = "doc" / "html"
+  webUploadOutput = "web" / "upload"
+  docHackDir = "tools" / "dochack"
 
 proc exe*(f: string): string =
   result = addFileExt(f, ExeExt)
@@ -267,8 +268,6 @@ proc buildDocSamples(nimArgs, destPath: string) =
   exec(findNim() & " doc $# -o:$# $#" %
     [nimArgs, destPath / "docgen_sample.html", "doc" / "docgen_sample.nim"])
 
-proc pathPart(d: string): string = splitFile(d).dir.replace('\\', '/')
-
 proc buildDoc(nimArgs, destPath: string) =
   # call nim for the documentation:
   var
@@ -325,11 +324,15 @@ proc buildPdfDoc*(nimArgs, destPath: string) =
 proc buildJS() =
   exec(findNim() & " js -d:release --out:$1 web/nimblepkglist.nim" %
       [webUploadOutput / "nimblepkglist.js"])
-  exec(findNim() & " js tools/dochack/dochack.nim")
+  exec(findNim() & " js " & (docHackDir / "dochack.nim"))
 
 proc buildDocs*(args: string) =
-  let a = nimArgs & " " & args
-  buildJS()
+  let
+    a = nimArgs & " " & args
+    docHackJs = "dochack.js"
+    docHackJsSource = docHackDir / "nimcache" / docHackJs
+    docHackJsDest = docHtmlOutput / docHackJs
+  buildJS()                     # This call generates docHackJsSource
   let docup = webUploadOutput / NimVersion
   createDir(docup)
   buildDocSamples(a, docup)
@@ -340,3 +343,4 @@ proc buildDocs*(args: string) =
   createDir(docHtmlOutput)
   buildDocSamples(nimArgs, docHtmlOutput)
   buildDoc(nimArgs, docHtmlOutput)
+  copyFileWithPermissions(docHackJsSource, docHackJsDest)