generate_build_files.sh (2221B)
1 #!/bin/bash 2 3 # After this point: 4 # * eE: All commands should succeed. 5 # * u: All variables should be defined before use. 6 # * o pipefail: All stages of all pipes should succeed. 7 set -eEuo pipefail 8 9 function find_repo_type() 10 { 11 if [ -d ".git" ]; then 12 MOZ_REPO="git" 13 elif [ -d ".hg" ]; then 14 MOZ_REPO="hg" 15 else 16 echo "Unable to detect repo (git or hg)" 17 exit 1 18 fi 19 } 20 21 find_repo_type 22 echo "repo type: $MOZ_REPO" 23 24 WEBRTC_GEN_LOG_FILE=$TMP_DIR/log_webrtc_gen.txt 25 ABSEIL_GEN_LOG_FILE=$TMP_DIR/log_abseil_gen.txt 26 27 echo "generate libwebrtc moz.build files" 28 ./mach python build/gn_processor.py \ 29 dom/media/webrtc/third_party_build/gn-configs/webrtc.json 2>&1| tee $WEBRTC_GEN_LOG_FILE 30 ERR_AND_WARN_CNT=`grep -Ei 'warning|error' $WEBRTC_GEN_LOG_FILE | wc -l | tr -d " " || true` 31 echo "ERR_AND_WARN_CNT: $ERR_AND_WARN_CNT" 32 if [ "x$ERR_AND_WARN_CNT" != "x0" ]; then 33 echo "libwebrtc moz.build generation has errors or warnings" 34 echo "see: $WEBRTC_GEN_LOG_FILE" 35 exit 1 36 fi 37 if [ "x$MOZ_REPO" == "xgit" ]; then 38 git status --short | grep "??" | awk '{ print $2; }' | xargs git add &> /dev/null || true 39 git add -u 40 git commit -m "Bug $BUG_NUMBER - update generated libwebrtc moz.build files" || true 41 else 42 hg status -nd | xargs hg rm 43 hg status -nu | xargs hg add 44 hg commit -m "Bug $BUG_NUMBER - update generated libwebrtc moz.build files" || true 45 fi 46 47 echo "generate abseil-cpp moz.build files" 48 ./mach python build/gn_processor.py \ 49 dom/media/webrtc/third_party_build/gn-configs/abseil.json 2>&1| tee $ABSEIL_GEN_LOG_FILE 50 ERR_AND_WARN_CNT=`grep -Ei 'warning|error' $ABSEIL_GEN_LOG_FILE | wc -l | tr -d " " || true` 51 echo "ERR_AND_WARN_CNT: $ERR_AND_WARN_CNT" 52 if [ "x$ERR_AND_WARN_CNT" != "x0" ]; then 53 echo "abseil-cpp moz.build generation has errors or warnings" 54 echo "see: $ABSEIL_GEN_LOG_FILE" 55 exit 1 56 fi 57 if [ "x$MOZ_REPO" == "xgit" ]; then 58 git status --short | grep "??" | awk '{ print $2; }' | xargs git add &> /dev/null || true 59 git add -u 60 git commit -m "Bug $BUG_NUMBER - update generated abseil-cpp moz.build files" || true 61 else 62 hg status -nd | xargs hg rm 63 hg status -nu | xargs hg add 64 hg commit -m "Bug $BUG_NUMBER - update generated abseil-cpp moz.build files" || true 65 fi