-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtasks.py
99 lines (91 loc) · 2.48 KB
/
tasks.py
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# see: http://docs.pyinvoke.org/en/stable/
from invoke import task
import platform
os = platform.system()
@task
def build(c, type="debug"):
"""Builds the library and the tests
"""
if "Darwin" == os:
c.run(
f"./scripts/build.sh --type {type}",
pty=True
)
elif "Linux" == os:
c.run(
f"./scripts/build.sh --type {type}",
pty=True
)
elif "Windows" == os:
c.run(
f"powershell -ExecutionPolicy ByPass \
./scripts/build.ps1 -type {type}"
)
else:
print("Unsupported platform!")
@task
def clean(c, type="debug"):
"""Build cleanup
"""
if "Darwin" == os:
c.run(
f"./scripts/clean.sh --type {type}",
pty=True
)
elif "Linux" == os:
c.run(
f"./scripts/clean.sh --type {type}",
pty=True
)
elif "Windows" == os:
build_dir = f"build/{type}_x64"
c.run(
f"powershell -ExecutionPolicy ByPass \
pushd {build_dir} ; ninja clean ; popd"
)
else:
print("Unsupported platform!")
@task
def test(c, type="debug", filter=""):
"""Runs all tests. Use the filter to specify individual tests.
"""
if "Darwin" == os:
c.run(
f"./scripts/test.sh --type {type} --filter '{filter}'",
pty=True
)
elif "Linux" == os:
c.run(
f"./scripts/test.sh --type {type} --filter '{filter}'",
pty=True
)
elif "Windows" == os:
c.run(
f"powershell -ExecutionPolicy ByPass \
./scripts/test.ps1 -type {type} -filter '{filter}'"
)
else:
print("Unsupported platform!")
@task
def watch(c, type="debug", filter=""):
"""Runs all tests and watches for changes. Use the filter to specify individual tests.
"""
if "Darwin" == os:
c.run(
f"./scripts/watch.sh --type {type} --filter '{filter}'",
pty=True
)
elif "Linux" == os:
c.run(
f"./scripts/watch.sh --type {type} --filter '{filter}'",
pty=True
)
elif "Windows" == os:
if 0 == len(filter):
filter = '*'
c.run(
f"powershell -ExecutionPolicy ByPass \
./scripts/watch.ps1 -type {type} -filter '{filter}'"
)
else:
print("Unsupported platform!")