#!/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 # Get supportscript folder if [[ ! -d "supportscript" ]] then git clone ssh://git@dvm-linux02:7999/bl/supportscript.git fi source ./supportscript/supportscript.sh #setup environment if [[ "$DEVICE_IP" = "" ]]; then device=root@192.168.10.135 DEVICE_IP=192.168.10.135 else device=root@$DEVICE_IP fi # project pro file pro_path=application pro_name=denali.pro pro_type_debug="debug" pro_type_release="release" pro_type=$pro_type_release pro_debug="CONFIG+=debug CONFIG+=qml_debug" pro_release="CONFIG+=qtquickcompiler" pro_build=$pro_release out_path="build" setBuildVariables ${buildSpecs[@]} REMOTE_DIR=$(getRemoteCopyAddress "DEN_UI") STATUS_REPORT=$REMOTE_DIR/"StatusReport.csv" REPORT=Report # Get the build variables buildVariables=($(getUIBuildValues)) export majorVersion=${buildVariables[0]} export minorVersion=${buildVariables[1]} export buildNumber=${buildVariables[2]} # 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"_"$pro_type gcc_spec="-spec linux-g++" # poky env poky_qmake="/opt/b2qt/2.5.3/sysroots/x86_64-pokysdk-linux/usr/bin/qmake" poky_make="/opt/b2qt/2.5.3/sysroots/x86_64-pokysdk-linux/usr/bin/make" poky_out_base="poky_64" poky_out=$poky_out_base"_"$pro_type poky_spec="-spec devices/linux-oe-generic-g++" #build type detection and set function (debug/release) function buildType() { echo if [[ "$1" = "debug" ]]; then pro_build=$pro_debug pro_type=$pro_type_debug gcc_out=$gcc_out_base"_"$pro_type poky_out=$poky_out_base"_"$pro_type echo " ------------------------------ DEBUG BUILD" else echo " ------------------------------ RELASE BUILD" fi echo } #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 " ------------------------------Setting upt the project" git clone ssh://git@dvm-linux02:7999/bl/setupscript.git ./setupscript/projectsetup.sh "ui" cd application echo " ------------------------------ run the cppcheck" ./cppcheck.sh ../$out_path/ cd .. echo " ------------------------------ set the build type (debug/release)" buildType "$1" cd $out_path echo " ------------------------------ run the cppcheck diff" app_path=../$pro_path diff $app_path/cppcheck.log cppcheck.log 1> cppcheck.logdiff.log 2> cppcheck.logdiff.err diff $app_path/cppcheck.err cppcheck.err 1> cppcheck.errdiff.log 2> cppcheck.errdiff.err # ============================================================= echo " ------------------------------ Start building [$gcc_out]" mkdir -p $gcc_out cd $gcc_out echo " ------------------------------ run qmake" $gcc_qmake ../../$pro_path/$pro_name $gcc_spec $pro_build echo " ------------------------------ run make" build_err=../build_$gcc_out.err build_log=../build_$gcc_out.log $gcc_make -j4 1> $build_log 2> $build_err if [[ $(grep "error:" $build_err) != "" ]]; then echo "ERROR: Application Build Failed [$gcc_out]" echo "Build, Failed, $gcc_out" >> $STATUS_REPORT exit 2 else echo "Build, Passed" >> $STATUS_REPORT fi if [[ $(grep "warning:" $build_err) != "" ]]; then echo "WARNING: Application Build Has Warnings [$gcc_out]" #exit 3 fi cd .. # ============================================================= echo " ------------------------------ Start building [$poky_out]" mkdir -p $poky_out cd $poky_out echo " ------------------------------ run qmake" $poky_qmake ../../$pro_path/$pro_name $poky_spec $pro_build echo " ------------------------------ run make" build_err=../build_$poky_out.err build_log=../build_$poky_out.log $poky_make -j4 1> $build_log 2> $build_err if [[ $(grep "error:" $build_err) != "" ]]; then echo "ERROR: Application Build Failed [$poky_out]" exit 2 fi if [[ $(grep "warning:" $build_err) != "" ]]; then echo "WARNING: Application Build Has Warnings [$poky_out]" #exit 3 fi # ============================================================= echo " ------------------------------ stop denali on device [$DEVICE_IP]" ssh $device 'killall denali' sleep 1 echo " ------------------------------ copy denali on device [$DEVICE_IP]" scp ./denali $device://home/root/ sync;sync;sync; sleep 1 echo " ------------------------------ start denali on device[$DEVICE_IP]" ssh -f $device '/home/root/denali' 1>/dev/null 2>/dev/null #return back to out path cd .. #return back to main folder cd .. echo " ------------------------------ copy the out file into the server" LOG=Logs echo " ------------------------------ $poky_out" mkdir -p $REMOTE_DIR/$REPORT_DIR/$LOG cp $out_path/* $REMOTE_DIR/$REPORT_DIR/$LOG mkdir -p $REMOTE_DIR/$REPORT_DIR/bin/$poky_out cp $out_path/$poky_out/denali $REMOTE_DIR/$REPORT_DIR/bin/$poky_out sync;sync;sync; 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/denali $REMOTE_DIR/$REPORT_DIR/bin/$gcc_out sync;sync;sync; # Generate code reviews # Leave the sub workspace cd .. # Delete all the previous excel files rm -rf *.xlsx # If the scripts are already there, remove them if [[ -d cruciblerestapiscript ]] || [[ -d codereviewscript ]] then rm -rf cruciblerestapiscript rm -rf codereviewscript fi # Generate code review project getCodeReviewReport "UI" $REMOTE_DIR