Are you sure you won't add a proc for that? I think that would be better @Araq. Something like setTarget("tests/all") or a global target maybe. I think a command is that "a command" and the parameters should go extra.
@andrea I think the was thinking loud that this would be a way to do this. Not that it currently works.
btw i think we also want to be able to ./project.nims target or even ./project.nims which would execute default target. half of it already works by adding shebang #!/usr/bin/env nim however we still need access to command line parameters from script to manually exec compiler with appropriate target set. can not import os because it pulls in times module that does some importc stuff which does not work. so thats that.
EDIT: Added this to scriptconfig.nim:
cbconf paramStr: setResult(a, os.paramStr(int(a.getInt(0)))) cbconf paramCount: setResult(a, os.paramCount())And this to nims script of project:
if paramCount() >= 1: var target: string var script = paramStr(1) if script.ends_with(".nims"): if paramCount() == 2: target = paramStr(2) else: target = "default" exec "nim $1 $2" % [target, script.substr(0, script.len - 2)]
Now i can just ./project.nims target or ./project.nims for default target.
Just some update:
setCommand now also takes an optional project filename. The compiler supports config.nims as a directory-wide configuration file.
The last devel is broken or what am I doing wrong? config.nims:
#!/usr/bin/env nim mode = ScriptMode.Verbose task build, "Build the application!!": setCommand "c src/portal-dividends-loader"
build Build the application!! Error: invalid command: 'build'
Compiler test: ./koch tests c newconfig:
FAIL: tfoo.nim Test "tests/newconfig/tfoo.nim" in category "newconfig" Failure: reNimcCrash Expected: Gotten: invalid command: 'default'
@r-ku: It is an extension to system.nim, listed here:
@vega: Works for me:
@Araq: here is my steps to reproduce:
git clone https://github.com/nim-lang/Nim && cd Nim ./bootstrap.sh sudo ./install.sh /usr/local/bin ./koch tests c newconfig
And it's fails:
/home/vega/work/nim/test/Nim/tests/testament/tester c newconfig FAIL: tfoo.nim Test "tests/newconfig/tfoo.nim" in category "newconfig" Failure: reNimcCrash Expected: Gotten: invalid command: 'default'
Nim Compiler Version 0.11.3 (2015-09-30) [Linux: amd64] Copyright (c) 2006-2015 by Andreas Rumpf git hash: d80f1633844597f3a8020fc156d2d889bf897d97 active boot switches: -d:release
What am I doing wrong
Linux xvega 3.13.0-54-generic #91-Ubuntu SMP Tue May 26 19:15:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux