-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnimalyzer.nimble
54 lines (42 loc) · 2.02 KB
/
nimalyzer.nimble
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
import std/os
# Package
version = "0.11.0"
author = "Bartek thindil Jasicki"
description = "A static code analyzer for Nim"
license = "BSD-3-Clause"
namedBin["main"] = "nimalyzer"
binDir = "bin"
srcDir = "src"
installFiles = @["nimalyzer.nim"]
# Dependencies
requires "nim >= 1.6.10"
requires "contracts >= 0.2.2"
requires "coloredlogger >= 0.1.0"
requires "unittest2"
# Tasks
var execName = changeFileExt("nimalyzer", ExeExt)
task debug, "builds the project in debug mode":
exec "nim c -d:debug --styleCheck:hint --spellSuggest:auto --errorMax:0 --outdir:" &
binDir & " --out:" & binDir & DirSep & execName & " src" & DirSep & "main.nim"
task release, "builds the project in release mode":
exec "nimble install -d -y"
exec "nim c -d:release --passc:-flto --passl:-s --outdir:" & binDir &
" --out:" & binDir & DirSep & execName & " src" & DirSep &
"main.nim"
task test, "run the project unit tests":
for file in listFiles("tests"):
if file.endsWith("nim"):
exec "nim c --verbosity:0 -r " & file & " -v"
task releasewindows, "builds the project in release mode for Windows 64-bit":
exec "nimble install -d -y"
exec "nim c -d:mingw --os:windows --cpu:amd64 --amd64.windows.gcc.exe:x86_64-w64-mingw32-gcc --amd64.windows.gcc.linkerexe=x86_64-w64-mingw32-gcc -d:release --passc:-flto --passl:-s --outdir:" &
binDir & " --out:" & binDir & "/nimalyzer.exe src" & DirSep & "main.nim"
task tools, "builds the project's tools":
exec "nim c -d:release --passc:-flto --passl:-s --styleCheck:hint --spellSuggest:auto --errorMax:0 --outdir:" &
binDir & " tools" & DirSep & "gendoc.nim"
exec "nim c -d:release --passc:-flto --passl:-s --styleCheck:hint --spellSuggest:auto --errorMax:0 --outdir:" &
binDir & " tools" & DirSep & "genrule.nim"
task docs, "builds the project's documentation":
for file in ["configuration", "index", "available_rules"]:
exec "nim rst2html --index:on --outdir:htmldocs doc" & DirSep & file & ".rst"
exec "nim doc --project --outdir:htmldocs src" & DirSep & "main.nim"