-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.sh
37 lines (37 loc) · 1.16 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
# Build File To Run The Project
while getopts d:c:r:o: flag
do
case "${flag}" in
c) check=${OPTARG};;
d) detail=${OPTARG};;
r) run=${OPTARG};;
o) optimize=${OPTARG};;
esac
done
clear
bash ./clean.sh
rm ./LinkerTest/Linker_Linked.br.wasm
touch ./LinkerTest/Linker_Linked.br.wasm
if [ "$optimize" == "true" ]; then
grain index.gr --release --dir . -- "./LinkerTest/index.br.wasm" "./LinkerTest/Linker_Linked.br.wasm"
else
grain index.gr --dir . -- "./LinkerTest/index.br.wasm" "./LinkerTest/Linker_Linked.br.wasm"
fi
if [ "$detail" == "true" ]; then
if [ "$check" == "true" ]; then
wasm2wat ./LinkerTest/Linker_Linked.br.wasm -o ./LinkerTest/Linker_Linked.br.wat --verbose
else
wasm2wat ./LinkerTest/Linker_Linked.br.wasm -o ./LinkerTest/Linker_Linked.br.wat --verbose --no-check
fi
else
wasm2wat ./LinkerTest/Linker_Linked.br.wasm -o ./LinkerTest/Linker_Linked.br.wat --no-check
fi
# Log The Size
filesize=$(stat -f%z index.gr.wasm)
filesize=$(bc <<< "scale=3; $filesize / 1024")
echo "$filesize"kb >> oldSize.txt
echo "$filesize"kb
# Try and run
if [ "$run" == "true" ]; then
wasmtime ./LinkerTest/Linker_Linked.br.wasm
fi