#!/bin/bash # $./run.build.sh release 5.12.5 /media/sf_VMSHARE #setup Qt dir version if [[ "$2" = "" ]]; then QT_VER="" else QT_VER=$2 fi #Setting up server folder if [[ "$3" = "" ]]; then SERVER_DIR="/media/XDrive" else SERVER_DIR=$3 fi # project pro file project=VSquishQt pro_path=vsquishqt pro_name=$project.pro pro_build="CONFIG+=qtquickcompiler" out_path="build" REMOTE_DIR="$SERVER_DIR/Users/Bamboo-Projects/DEN_VV/$project" REPORT_DIR="$timeStamp-BuildNo-$buildNumber-$buildPlan" # gcc env gcc_qmake="/opt/Qt$QT_VER/5.12.5/gcc_64/bin/qmake" gcc_make="/usr/bin/make" gcc_out_base="gcc_64" gcc_out=$gcc_out_base gcc_spec="-spec linux-g++" #check if the out folders already exists if [[ -e $out_path ]]; then rm -frd $out_path fi echo " ------------------------------ create the build folder" mkdir $out_path if [[ -e $pro_path ]]; then rm -frd $pro_path fi if [[ "$1" = "clean" ]]; then exit 0 fi echo " ------------------------------ clone the $project repository" git clone ssh://git@dvm-linux02:7999/vv/vsquishqt.git cd $out_path # ============================================================= echo " ------------------------------ Start building [$gcc_out]" mkdir -p $gcc_out cd $gcc_out build_err=../build_$gcc_out.err build_log=../build_$gcc_out.log echo " ------------------------------ run qmake" $gcc_qmake ../../$pro_path/$pro_name $gcc_spec $pro_build 1> $build_log 2> $build_err echo " ------------------------------ run make" $gcc_make -j4 1>> $build_log 2>> $build_err if [[ $(grep "error:" $build_err) != "" ]]; then echo "ERROR: $project Build Failed [$gcc_out]" exit 2 fi if [[ $(grep "warning:" $build_err) != "" ]]; then echo "WARNING: $project Build Has Warnings [$gcc_out]" #exit 3 fi cd .. #return back to out path cd .. echo " ------------------------------ copy the out file into the server" LOG=Logs echo " ------------------------------ $gcc_out" mkdir -p $REMOTE_DIR/$REPORT_DIR/$LOG cp $out_path/* $REMOTE_DIR/$REPORT_DIR/$LOG mkdir -p $REMOTE_DIR/$REPORT_DIR/bin/$gcc_out cp $out_path/$gcc_out/$project $REMOTE_DIR/$REPORT_DIR/bin/$gcc_out sync;sync;sync;