-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmk
executable file
·140 lines (109 loc) · 3.16 KB
/
mk
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env bash
#
# [email protected] | 2024-12-13 03:28:43
#
#
set -eu
export root=`pwd`
port=2022
# parse the cli
while [[ $# -gt 0 ]]
do
case $1 in
init)
/bin/rm -fr build/
cmake -Bbuild .
shift
;;
build)
clear
# remove the old unit test
/bin/rm -f $root/build/unit
# cmake --build build/
(cd build && make -j4)
$root/build/cryptor --version
ln $root/build/cryptor $root/build/unit
shift
;;
unit)
$root/build/unit
shift
;;
test)
# TODO check that unit has been built and is newer that all the souces
$root/build/unit
$root/build/integration
bat --paging=never $root/service.log
shift
;;
run)
# TODO check that cryptor has been built and is newer that all the souces
$root/build/cryptor --base $root/html
shift
;;
run-debug)
# TODO check that cryptor has been built and is newer that all the souces
$root/build/cryptor --base $root/html --level 0
shift
;;
format)
clang-format -i include/*.hpp src/*.cpp
git status -s
shift
;;
clean)
(cd build && make clean && /bin/rm -f unit)
shift
;;
clobber)
/bin/rm -fr build/
shift
;;
watch)
watchexec -c -w src/ -w include/ -e h,hpp,cpp ./mk build test
exit 0
;;
shutdown)
curl -k -XDELETE https://localhost:$port/shutdown
shift
;;
pull)
git pull
shift
;;
page)
curl -k https://localhost:$port
shift
;;
version)
curl -k https://localhost:$port/version
shift
;;
help)
echo "Targets:"
echo ""
echo " init : run the cmake command to create the build folder"
echo " build : compile cryptor to the build folder"
echo " test : run all tests"
echo " run : runs the app and shows version"
echo " run-debug: runs the service with logging set to debug"
echo " format : runs clang-format over includes and src"
echo " watch : run watcher over source and include"
echo " pull : pull the latest repo changes"
echo " clean : remove binary builds but leave the build folder"
echo " clobber : remove the entire build folder"
echo " show : runs curl against localhost to view index page"
echo " shutdown : runs localhost curl shutdown the server"
echo " help : show this help"
exit 0
;;
build)
cd src && pwd && make && make unit
shift
;;
*)
./mk help
exit 0
;;
esac
done