-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
171 lines (153 loc) · 4.77 KB
/
Taskfile.yml
File metadata and controls
171 lines (153 loc) · 4.77 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
---
version: '3'
vars:
CC: gcc
CC_FLAGS: "-Werror -Wextra -Wall -Wfree-nonheap-object -std=c17"
EXECUTABLE_NAME: cerver
DYN_LIBS_USED_PATH: "-L/usr/local/lib/standardloop"
DYN_LIBS_USED: "-pthread -lstandardloop-logger -lstandardloop-util -lstandardloop-json"
SOURCE_FILES:
- cerver.c
- thread/pool.c
- thread/worker.c
- thread/scheduler.c
- http/handler.c
- http/router.c
- structures/queue/queue.c
- http/response/codes.c
- http/response/response.c
- http/request/request.c
- http/request/parser/body.c
- http/request/parser/host.c
- http/request/parser/path.c
- http/request/parser/port.c
- http/request/parser/query.c
- http/request/parser/method.c
- http/request/parser/headers.c
- http/request/parser/version.c
# Inputs
# - REPO_NAME
# - DYLIB_VERSION
# - DYLIB_NAME
download-dependency: &download-dependency |
mkdir -p dependencies/tmp-{{.DYLIB_NAME}}
cd dependencies/tmp-{{.DYLIB_NAME}}
curl -O -J -L https://github.com/standardloop/{{.REPO_NAME}}/releases/download/v{{.DYLIB_VERSION}}/libstandardloop-{{.DYLIB_NAME}}.zip
unzip libstandardloop-{{.DYLIB_NAME}}.zip
sudo mkdir -p /usr/local/lib/standardloop/
sudo mkdir -p /usr/local/include/standardloop/
sudo mv libstandardloop-{{.DYLIB_NAME}}.dylib /usr/local/lib/standardloop/
sudo mv {{.DYLIB_NAME}}.h /usr/local/include/standardloop/ && rm libstandardloop-{{.DYLIB_NAME}}.zip
tasks:
default:
silent: true
deps:
- build
# - build:sanitize
# - run
dependencies:
deps:
- dependencies:logger
- dependencies:util
- dependencies:json
dependencies:logger:
vars:
REPO_NAME: c-logger
DYLIB_VERSION: 0.0.7
DYLIB_NAME: logger
cmds:
- sudo -v
- *download-dependency
status:
- otool -L /usr/local/lib/standardloop/libstandardloop-{{.DYLIB_NAME}}.dylib | head -n 2 | tail -n 1 | grep "current version {{.DYLIB_VERSION}}"
- cat /usr/local/include/standardloop/{{.DYLIB_NAME}}.h | grep "STANDARDLOOP_{{.DYLIB_NAME | upper}}_H_VERSION \"{{.DYLIB_VERSION}}\""
dependencies:util:
vars:
REPO_NAME: c-util
DYLIB_VERSION: 0.0.3
DYLIB_NAME: util
cmds:
- sudo -v
- *download-dependency
status:
- otool -L /usr/local/lib/standardloop/libstandardloop-{{.DYLIB_NAME}}.dylib | head -n 2 | tail -n 1 | grep "current version {{.DYLIB_VERSION}}"
- cat /usr/local/include/standardloop/{{.DYLIB_NAME}}.h | grep "STANDARDLOOP_{{.DYLIB_NAME | upper}}_H_VERSION \"{{.DYLIB_VERSION}}\""
dependencies:json:
vars:
REPO_NAME: c-json
DYLIB_VERSION: 0.0.2
DYLIB_NAME: json
cmds:
- sudo -v
- *download-dependency
status:
- otool -L /usr/local/lib/standardloop/libstandardloop-{{.DYLIB_NAME}}.dylib | head -n 2 | tail -n 1 | grep "current version {{.DYLIB_VERSION}}"
- cat /usr/local/include/standardloop/{{.DYLIB_NAME}}.h | grep "STANDARDLOOP_{{.DYLIB_NAME | upper}}_H_VERSION \"{{.DYLIB_VERSION}}\""
# dependencies:clean:
# cmds:
build:
deps:
- dependencies
cmds:
- |
{{.CC}} {{.CFLAGS}} \
main.c \
{{range .SOURCE_FILES}} {{.}} {{end}} \
{{.DYN_LIBS_USED_PATH}} \
{{.DYN_LIBS_USED}} \
-o {{.EXECUTABLE_NAME}}
sources:
- ./**/*.c
generates:
- "{{.EXECUTABLE_NAME}}"
run:
deps:
- build
cmds:
- ./{{.EXECUTABLE_NAME}}
sanitize:
deps:
- run:sanitize
build:sanitize:
run: once
deps:
- dependencies
cmds:
- |
{{.CC}} {{.CFLAGS}} \
main.c \
-fsanitize=address \
-fno-omit-frame-pointer \
{{range .SOURCE_FILES}} {{.}} {{end}} \
{{.DYN_LIBS_USED_PATH}} \
{{.DYN_LIBS_USED}} \
-o {{.EXECUTABLE_NAME}}-sanitize
sources:
- ./**/*.c
generates:
- "{{.EXECUTABLE_NAME}}-sanitize"
run:sanitize:
deps:
- build:sanitize
cmds:
- ./{{.EXECUTABLE_NAME}}-sanitize
clean:
allow_failures: true
cmds:
- rm -f {{.EXECUTABLE_NAME}}
- rm -f {{.EXECUTABLE_NAME}}-debug
- rm -f {{.EXECUTABLE_NAME}}-sanitize
- rm -f {{.EXECUTABLE_NAME}} optimize
- rm -f a.out
leaks:cp:
deps:
- build
cmds:
- cp /usr/local/lib/standardloop/libstandardloop-util.dylib ./ # to get around sips we need to move dylibs to local dir :(
- cp /usr/local/lib/standardloop/libstandardloop-json.dylib ./ # to get around sips we need to move dylibs to local dir :(
- cp /usr/local/lib/standardloop/libstandardloop-logger.dylib ./ # to get around sips we need to move dylibs to local dir :(
leaks:clean:
cmds:
- rm -f libstandardloop-logger.dylib
- rm -f libstandardloop-json.dylib
- rm -f libstandardloop-util.dylib