-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.nims
More file actions
84 lines (71 loc) · 1.93 KB
/
config.nims
File metadata and controls
84 lines (71 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# Common arguments
#
--mm:atomicArc
--deepcopy:on
--verbosity:1
--path:"local"
# begin Nimble config (version 2)
--noNimblePath
when withDir(thisDir(), system.fileExists("nimble.paths")):
include "nimble.paths"
# end Nimble config
# <percy>
--noNimblePath
import
std/strutils
when withDir(thisDir(), system.fileExists("vendor/percy.paths")):
for path in readFile("vendor/percy.paths").split("\n"):
if path.strip().len > 0:
switch("path", path)
# </percy>
# <percy>
#
# Build Task
#
import
std/os,
std/json,
std/strutils
#
# Internal commands
#
proc build(args: seq[string]): void =
var
cfg = parseJson("{\"namedbin\":{},\"srcDir\":\".\",\"binDir\":\".\"}")
when defined(windows):
let
(info, error) = gorgeEx("percy info -j 2>NUL")
else:
let
(info, error) = gorgeEx("percy info -j 2>/dev/null")
if error == 0:
cfg = parseJson(info)
let
srcDir = strip(cfg["srcDir"].getStr(), leading = false, chars = {'/'}) & "/"
binDir = strip(cfg["binDir"].getStr(), leading = false, chars = {'/'}) & "/"
for srcName, binName in cfg["namedBin"]:
let
cmd = @[
"nim -o:" & binDir & binName.getStr(),
commandLineParams()[1..^1].join(" "),
args.join(" "),
"c " & srcDir & srcName
].join(" ")
echo "Executing: " & cmd
exec cmd
task build, "Build the application (whatever it's called)":
when defined release:
build(@["--opt:speed", "--checks:on"])
elif defined debug:
build(@["--debugger:native", "--stacktrace:on", "--linetrace:on", "--checks:on"])
else:
build(@["--stacktrace:on", "--linetrace:on", "--checks:on"])
# </percy>
# <percy>
#
# Test Task
#
task test, "Run testament tests":
exec "testament --megatest:off --directory:testing " & commandLineParams()[1..^1].join(" ")
# </percy>