Skip to content

Commit

Permalink
Merge pull request #85 from codecae/build_script_parse_fix
Browse files Browse the repository at this point in the history
Updated build script to fail upon compilation error and report status of all files
  • Loading branch information
mikeller authored Nov 21, 2017
2 parents 6d853d2 + fa49ce0 commit 6c3ded4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fi
cp -fR src/* obj

MANIFEST=(`find obj/ -name *.lua -type f`);
LAST_FAILURE=0

if [ ${#MANIFEST[@]} -eq 0 ]; then
echo -e "\e[1m\e[39m[\e[31mTEST FAILED\e[39m]\e[21m No scripts could be found!."
Expand All @@ -20,9 +21,15 @@ do
SRC_NAME=$f
OBJ_NAME=$(dirname ${f})/$(basename ${f} .lua).luac
echo -e "Compiling file \e[1m${SRC_NAME}\e[21m..."
luac -s -o ${OBJ_NAME} ${SRC_NAME} || \
echo -e "\e[1m\e[39m[\e[31mBUILD FAILED\e[39m]\e[21m Compilation error in file \e[1m${SRC_NAME}\e[21m!" || \
exit 1
luac -s -o ${OBJ_NAME} ${SRC_NAME}
_fail=$?
if [[ $_fail -ne 0 ]]; then
LAST_FAILURE=$_fail
echo -e "\e[1m\e[39m[\e[31mBUILD FAILED\e[39m]\e[21m Compilation error in file ${SRC_NAME}\e[1m"
fi
done

echo -e "\e[1m\e[39m[\e[32mTEST SUCCESSFUL\e[39m]\e[21m All lua files built successfully!"
if [[ $LAST_FAILURE -eq 0 ]]; then
echo -e "\e[1m\e[39m[\e[32mTEST SUCCESSFUL\e[39m]\e[21m All lua files built successfully!"
fi
exit $LAST_FAILURE

0 comments on commit 6c3ded4

Please sign in to comment.