-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·59 lines (47 loc) · 1.1 KB
/
build.sh
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
#!/bin/bash
tick="$(date -u +%s)"
if [ "$1" = "clean" ]; then
# clean driver
ninja -C driver/build-debug clean
ninja -C driver/build-release clean
# clean frontend
ninja -C frontend/build-debug clean
ninja -C frontend/build-release clean
# clean site
rm static/dist/*.js
# clean server
go clean
elif [ "$1" = "prod" ]; then
# build driver
ninja -C driver/build-release driver install
# build frontend
ninja -C frontend/build-release
# build site
cd static
npm run build-prod
cd ..
# build server
cp -r static/dist server/server
cd server
echo 'building server...'
go clean
go build -tags release -ldflags "-s -w"
cd ..
rm -rf server/server/dist
else
# build driver
ninja -C driver/build-debug driver install
# build frontend
ninja -C frontend/build-debug
# build site
cd static
npm run build
cd ..
# build server
echo 'building server...'
go clean
go build -tags debug
fi
tock="$(date -u +%s)"
elapsed="$(($tock-$tick))"
echo "finished in $elapsed seconds"