-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·67 lines (59 loc) · 1.59 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
63
64
65
66
67
forceBuild='false'
localBuild='false'
CleanUpProject() {
echo "-----Starting Clean Up-----"
echo "Removing target directory..."
rm -r target/
echo "-----Finished Clean Up-----"
}
BuildProject() {
if [ -d target/ ] && [ $forceBuild == 'false' ] ;
then
echo "Build already exists. Please clean up with the -c flag and rebuild."
echo "Or force a build with the -f flag"
exit 1
else
CleanUpProject
fi
echo "-----Starting Build-----"
echo "Importing Env Vars from .env file."
export $(grep -v '^#' .env | xargs)
echo "Checking Env Vars: "
for ENV in $(cat .env | awk -F= '{print $1}')
do
echo "Var Name: $ENV ----- Value: $(printenv $ENV)"
done
echo "Beginning Build."
mkdir "target"
echo "Moving backend"
cp -r backend target/
echo "Moving Frontend."
cp -r frontend target/
echo "Building Backend"
echo $localBuild
if [ $localBuild == 'true' ] ;
then
cd target/backend/data-server
go run *.go
fi
}
while getopts 'cflh' flag; do
case "${flag}" in
c) CleanUpProject
exit 0;;
f) forceBuild='true';;
l) localBuild='true';;
h)
echo "CoinbaseBoard - attempt to build CoinbaseBoard"
echo " "
echo "To Run:"
echo "bash build.sh [arguments]"
echo " "
echo "options:"
echo "-h Show brief help"
echo "-f Force a build while cleaning previous build"
echo "-c, Clean Up A previous Build";;
*) break ;;
esac
done
BuildProject