-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·63 lines (55 loc) · 1.48 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
60
61
62
#!/bin/bash
function show_result {
# if return code is zero, then echo "Done" else echo "Failed"
if [ $? -ne 0 ]; then
# echo a red "Failed"
echo -e "\033[0;31mFailed\033[0m"
else
# echo a gree "Done"
echo -e "\033[0;32mDone\033[0m"
fi
}
function show_lize_result {
# if return code is zero, then echo "Done" else echo "Failed"
if [ $? -ne 0 ]; then
# echo a red "Failed"
echo -e "\033[0;31mFailed\033[0m"
tail -n 50 build/$1.log
echo "open build/$1.log to see the log."
else
# echo a gree "Done"
echo -e "\033[0;32mDone\033[0m"
fi
echo "Open build/$1.log to see the log."
echo "Open build/$1.tex to see the LaTeX source."
echo "Open output/$1.pdf to see the result."
}
function build {
mkdir -p build
opam exec -- forester build # 2>&1 > build/forester.log # --dev
show_result
# echo "Open build/forester.log to see the log."
}
function lize {
./lize.sh spin-0001 2>&1 > /dev/null
show_lize_result spin-0001
./lize.sh hopf-0001 2>&1 > /dev/null
show_lize_result hopf-0001
./lize.sh ca-0001 2>&1 > /dev/null
show_lize_result ca-0001
./lize.sh tt-0001 2>&1 > /dev/null
show_lize_result tt-0001
./lize.sh math-000C 2>&1 > /dev/null
show_lize_result math-000C
# ./lize.sh math-0001 2>&1 > /dev/null
# show_lize_result math-0001
}
echo "⭐ Rebuilding forest"
time build
echo
#if environment variable CI or LIZE is set
if [ -n "$CI" ] || [ -n "$LIZE" ]; then
echo "⭐ Rebuilding LaTeX"
time lize
echo
fi