-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.nims
49 lines (41 loc) · 1.17 KB
/
config.nims
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
if defined(release) or defined(danger):
--opt: speed
--passC: "-flto"
--passL: "-flto"
--passL: "-s"
else:
--checks: on
--assertions: on
--spellSuggest
--styleCheck: error
--mm:arc
import std/[os, sequtils]
from std/strutils import startsWith, endsWith
from std/strformat import `&`
const IgnorePathPrefixes = ["."]
func isIgnored(path: string): bool =
IgnorePathPrefixes.mapIt(path.startsWith(it)).anyIt(it)
iterator modules(dir: string = getCurrentDir()): string =
for path in walkDirRec(dir, relative = true):
if not path.isIgnored() and path.endsWith(".nim"):
yield path
############ Tasks
task test, "Test semuanya":
--warning: "BareExcept:off"
--hints: off
var failedUnits: seq[string]
for path in modules():
echo &"Testing {path}:"
try: selfExec(&"-f --warning[BareExcept]:off --hints:off r \"{path}\"")
except OSError:
failedUnits.add(path)
if failedUnits.len > 0:
echo "Test yang Gagal:"
for path in failedUnits:
echo &"- {path}"
quit(1)
else:
echo "Semua Test Berjalan dengan baik"
task prettyfy, "Run nimpretty untuk semua file":
for path in modules():
exec(&"nimpretty --indent:2 \"{path}\"")