From 163a1782e6849b454ba5c57d16ec8d07b2dffb05 Mon Sep 17 00:00:00 2001 From: dsavvinov Date: Mon, 29 Aug 2016 10:32:11 +0300 Subject: [PATCH] Updated build-script with error handling --- build.sh | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 00000000000..ef7d9cb5155 --- /dev/null +++ b/build.sh @@ -0,0 +1,75 @@ +#!/bin/bash +clr='\033[1;33m' +red='\033[0;31m' +nc='\033[0m' + +# ============= Building ================ +# Build Proto Compiler +echo -e "${clr}Building protoc compiler${nc}" +cd proto/compiler +echo -e "${clr}Checking prerequisites for building protoc${nc}" +./pre-build.sh +if [ $? -ne 0 ]; then + echo -e "${red}Error launching carkot/proto/compiler/pre-build.sh${nc}" + exit 1 +fi + +echo -e "${clr}Building protoc${nc}" +make +if [ $? -ne 0 ]; then + echo -e "${red}Error building protoc with carkot/proto/compiler/Makefile ${nc}" + exit 1 +fi +cd ../../ + +# Compile proto-files +echo -e "${clr}Compiling proto-files sources${nc}" +cd proto/protofiles_sources +./compile_proto.sh +if [ $? -ne 0 ]; then + echo -e "${red}Error compiling proto-files with carkot/proto/protofiles_sources/compile_proto.sh${nc}" + exit 1 +fi +cd ../../ + +# Build central server +echo -e "${clr}Building central server${nc}" +cd server +./gradlew build +if [ $? -ne 0 ]; then + echo -e "${red}Error building central server with carkot/server/gradlew build${nc}" + exit 1 +fi +cd ../ + +# Build Raspberry server +echo -e "${clr}Building Raspberry Pi server${nc}" +cd car_srv/kotlinSrv +./build.sh +if [ $? -ne 0 ]; then + echo -e "${red}Error building Raspberry Pi server with carkot/car_srv/kotlinSrv/build.sh${nc}" + exit 1 +fi +cd ../../ + +# Build Kotlin->Native translator +echo -e "${clr}Building translator${nc}" +cd translator +./gradlew jar +if [ $? -ne 0 ]; then + echo -e "${red}Error building translator with translator/gradlew jar${nc}" + exit 1 +fi +cd ../ + +# Build Kotstd libary for translator +echo -e "${clr}Building Kotstd${nc}" +cd kotstd +make +if [ $? -ne 0 ]; then + echo -e "${red}Error building Kotlin STDlib with kotstd/Makefile${nc}" + exit 1 +fi + + +