summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2014-02-08 15:59:42 +0000
committerDominik Picheta <dominikpicheta@googlemail.com>2014-02-08 15:59:42 +0000
commita3f3efa1ba9e8d95acdf81e4bd07aa180c383906 (patch)
tree7a54f1d10f122256421c8654e3513b03679a2da6 /koch.nim
parent471c0aa6349b7ad41d70b64ed370106bed9f0d01 (diff)
parenta70235daaa2b73bfc04fa53583be56adefd1deb8 (diff)
downloadNim-a3f3efa1ba9e8d95acdf81e4bd07aa180c383906.tar.gz
Merge branch 'devel' into newasync
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim44
1 files changed, 27 insertions, 17 deletions
diff --git a/koch.nim b/koch.nim
index 97fcf5b2c..4d2b3bfb7 100644
--- a/koch.nim
+++ b/koch.nim
@@ -1,7 +1,7 @@
 #
 #
 #         Maintenance program for Nimrod  
-#        (c) Copyright 2013 Andreas Rumpf
+#        (c) Copyright 2014 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
@@ -26,7 +26,7 @@ const
 +-----------------------------------------------------------------+
 |         Maintenance program for Nimrod                          |
 |             Version $1|
-|             (c) 2013 Andreas Rumpf                              |
+|             (c) 2014 Andreas Rumpf                              |
 +-----------------------------------------------------------------+
 Build time: $2, $3
 
@@ -42,9 +42,10 @@ Possible Commands:
   csource [options]        builds the C sources for installation
   zip                      builds the installation ZIP package
   inno [options]           builds the Inno Setup installer (for Windows)
-  tests                    run the testsuite
+  tests [options]          run the testsuite
   update                   updates nimrod to the latest version from github
                            (compile koch with -d:withUpdate to enable)
+  temp options             creates a temporary compiler for testing
 Boot options:
   -d:release               produce a release version of the compiler
   -d:tinyc                 include the Tiny C backend (not supported on Windows)
@@ -109,16 +110,16 @@ proc findStartNimrod: string =
   # If these fail, we try to build nimrod with the "build.(sh|bat)" script.
   var nimrod = "nimrod".exe
   result = "bin" / nimrod
-  if ExistsFile(result): return
+  if existsFile(result): return
   for dir in split(getEnv("PATH"), PathSep):
-    if ExistsFile(dir / nimrod): return nimrod
+    if existsFile(dir / nimrod): return dir / nimrod
   when defined(Posix):
     const buildScript = "build.sh"
-    if ExistsFile(buildScript): 
+    if existsFile(buildScript): 
       if tryExec("./" & buildScript): return "bin" / nimrod
   else:
     const buildScript = "build.bat"
-    if ExistsFile(buildScript): 
+    if existsFile(buildScript): 
       if tryExec(buildScript): return "bin" / nimrod
   
   echo("Found no nimrod compiler and every attempt to build one failed!")
@@ -177,24 +178,24 @@ proc cleanAux(dir: string) =
       of "nimcache": 
         echo "removing dir: ", path
         removeDir(path)
-      of "dist", ".git", "icons": nil
+      of "dist", ".git", "icons": discard
       else: cleanAux(path)
-    else: nil
+    else: discard
 
 proc removePattern(pattern: string) = 
-  for f in WalkFiles(pattern): 
+  for f in walkFiles(pattern): 
     echo "removing: ", f
     removeFile(f)
 
 proc clean(args: string) = 
-  if ExistsFile("koch.dat"): removeFile("koch.dat")
+  if existsFile("koch.dat"): removeFile("koch.dat")
   removePattern("web/*.html")
   removePattern("doc/*.html")
   cleanAux(getCurrentDir())
   for kind, path in walkDir(getCurrentDir() / "build"):
     if kind == pcDir: 
       echo "removing dir: ", path
-      RemoveDir(path)
+      removeDir(path)
 
 # -------------- update -------------------------------------------------------
 
@@ -259,14 +260,22 @@ when defined(withUpdate):
 
 # -------------- tests --------------------------------------------------------
 
+template `|`(a, b): expr = (if a.len > 0: a else: b)
+
 proc tests(args: string) =
   # we compile the tester with taintMode:on to have a basic
   # taint mode test :-)
-  exec("nimrod cc --taintMode:on tests/tester")
-  exec(getCurrentDir() / "tests/tester".exe & " reject")
-  exec(getCurrentDir() / "tests/tester".exe & " compile")
-  exec(getCurrentDir() / "tests/tester".exe & " run")
-  exec(getCurrentDir() / "tests/tester".exe & " merge")
+  exec "nimrod cc --taintMode:on tests/testament/tester"
+  let tester = quoteShell(getCurrentDir() / "tests/testament/tester".exe)
+  exec tester & " " & (args|"all")
+  exec tester & " html"
+
+proc temp(args: string) =
+  var output = "compiler" / "nimrod".exe
+  var finalDest = "bin" / "nimrod_temp".exe
+  exec("nimrod c compiler" / "nimrod")
+  copyExe(output, finalDest)
+  if args.len > 0: exec(finalDest & " " & args)
 
 proc showHelp() = 
   quit(HelpText % [NimrodVersion & repeatChar(44-len(NimrodVersion)), 
@@ -291,6 +300,7 @@ of cmdArgument:
       update(op.cmdLineRest)
     else:
       quit "this Koch has not been compiled with -d:withUpdate"
+  of "temp": temp(op.cmdLineRest)
   else: showHelp()
 of cmdEnd: showHelp()