pa: build.sh: propogate mka return code

This requires https://gerrit.aospa.co/#/c/3692/

As in the associated commit, this change propogates the return code to
the shell environment which called the script. It also prints "Build
Failed!" in red as an indication to the user that the build has failed.

Change-Id: Ifedffecf4bf87f908056779e5e26e8f997998872
Signed-off-by: Evan Anderson <evananderson@aospa.co>
This commit is contained in:
Evan Anderson 2017-08-09 20:39:26 -05:00
parent f90bbe5fb3
commit dfbf9ac6cc
No known key found for this signature in database
GPG Key ID: ACE81ECE3FC8973D
1 changed files with 11 additions and 0 deletions

View File

@ -152,6 +152,8 @@ fi
echo -e ""
# Build away!
RETVAL=0
echo -e "${CLR_BLD_BLU}Starting compilation${CLR_RST}"
echo -e ""
if [ "$FLAG_USER_BUILD" = 'y' ]; then
@ -159,11 +161,20 @@ if [ "$FLAG_USER_BUILD" = 'y' ]; then
else
mka bacon
fi
RETVAL=$?
echo -e ""
# Check if the build failed
if [ $RETVAL -ne 0 ]; then
echo "${CLR_BLD_RED}Build failed!"
echo -e ""
fi
# Check the finishing time
TIME_END=$(date +%s.%N)
# Log those times at the end as a fun fact of the day
echo -e "${CLR_BLD_GRN}Total time elapsed:${CLR_RST} ${CLR_GRN}$(echo "($TIME_END - $TIME_START) / 60" | bc) minutes ($(echo "$TIME_END - $TIME_START" | bc) seconds)${CLR_RST}"
echo -e ""
exit $RETVAL