summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-10-24 15:02:43 +0200
committerAraq <rumpf_a@web.de>2016-10-24 15:02:43 +0200
commit9605a0f87f16c0606231f04eb351574423302fad (patch)
tree68ea0425c8ea059457e85c98bcdf60d1273c0beb /koch.nim
parente700e3f205f8f206a6e24797b18154bd94edfc78 (diff)
downloadNim-9605a0f87f16c0606231f04eb351574423302fad.tar.gz
deprecated install_nimble.nims in favor of 'koch nimble'; refs #4934
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim23
1 files changed, 22 insertions, 1 deletions
diff --git a/koch.nim b/koch.nim
index 8262c7c3d..ad82b101a 100644
--- a/koch.nim
+++ b/koch.nim
@@ -49,6 +49,7 @@ Possible Commands:
   tests [options]          run the testsuite
   temp options             creates a temporary compiler for testing
   winrelease               creates a release (for coredevs only)
+  nimble                   builds the Nimble tool
 Boot options:
   -d:release               produce a release version of the compiler
   -d:tinyc                 include the Tiny C backend (not supported on Windows)
@@ -148,6 +149,8 @@ proc csource(args: string) =
        [args, VersionAsString, compileNimInst, findNim()])
 
 proc bundleNimbleSrc() =
+  ## bunldeNimbleSrc() bundles a specific Nimble commit with the tarball. We
+  ## always bundle the latest official release.
   if dirExists("dist/nimble/.git"):
     exec("git --git-dir dist/nimble/.git pull")
   else:
@@ -163,6 +166,23 @@ proc bundleNimbleExe() =
   exec(findNim() & " c dist/nimble/src/nimble.nim")
   copyExe("dist/nimble/src/nimble".exe, "bin/nimble".exe)
 
+proc buildNimble() =
+  ## buildNimble() builds Nimble for the building via "github". As such, we
+  ## choose the most recent commit of Nimble too.
+  var installDir = "dist/nimble"
+  if dirExists("dist/nimble/.git"):
+    exec("git --git-dir dist/nimble/.git pull")
+  else:
+    # if dist/nimble exist, but is not a git repo, don't mess with it:
+    if dirExists(installDir):
+      var id = 0
+      while dirExists("dist/nimble" & $id):
+        inc id
+      installDir = "dist/nimble" & $id
+    exec("git clone https://github.com/nim-lang/nimble.git " & installDir)
+  exec(findNim() & " c " & installDir / "src/nimble.nim")
+  copyExe(installDir / "src/nimble".exe, "bin/nimble".exe)
+
 proc bundleNimsuggest(buildExe: bool) =
   if dirExists("dist/nimsuggest/.git"):
     exec("git --git-dir dist/nimsuggest/.git pull")
@@ -371,7 +391,7 @@ of cmdArgument:
   of "boot": boot(op.cmdLineRest)
   of "clean": clean(op.cmdLineRest)
   of "web": web(op.cmdLineRest)
-  of "docs": web("--onlyDocs " & op.cmdLineRest)
+  of "doc", "docs": web("--onlyDocs " & op.cmdLineRest)
   of "json2": web("--json2 " & op.cmdLineRest)
   of "website": website(op.cmdLineRest & " --googleAnalytics:UA-48159761-1")
   of "web0":
@@ -389,5 +409,6 @@ of cmdArgument:
   of "test", "tests": tests(op.cmdLineRest)
   of "temp": temp(op.cmdLineRest)
   of "winrelease": winRelease()
+  of "nimble": buildNimble()
   else: showHelp()
 of cmdEnd: showHelp()