From 5c5bdc2c7be1aa19c1e36e8d6ffa1bd7e4c9128e Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Thu, 11 Jun 2015 22:52:39 -0300 Subject: [PATCH] Travis: use associative arrays This makes the script be more declarative and easier to extend. --- .travis.yml | 2 +- Tools/scripts/build_all_travis.sh | 54 +++++++++++++++---------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 286771fa3d..10c3a6a422 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ env: - TRAVIS_BUILD_TYPE=ArduCopter - TRAVIS_BUILD_TYPE=APMrover2 - TRAVIS_BUILD_TYPE=AntennaTracker - - TRAVIS_BUILD_TYPE=Replay + - TRAVIS_BUILD_TYPE=Tools/Replay addons: coverity_scan: diff --git a/Tools/scripts/build_all_travis.sh b/Tools/scripts/build_all_travis.sh index 15d3cae4a5..07535ebda9 100755 --- a/Tools/scripts/build_all_travis.sh +++ b/Tools/scripts/build_all_travis.sh @@ -17,37 +17,37 @@ travis_build_type_or_empty() { return 1 } -echo "Testing ArduPlane build" -pushd ArduPlane -for b in apm2; do - pwd - make clean - make $b -j4 -done -popd +declare -A build_platforms +declare -A build_concurrency +declare -A build_extra_clean -for d in ArduCopter APMrover2 ArduPlane AntennaTracker; do +build_platforms=( ["ArduPlane"]="apm2 navio sitl linux px4-v2" + ["ArduCopter"]="navio sitl linux px4-v2" + ["APMrover2"]="navio sitl linux px4-v2" + ["AntennaTracker"]="navio sitl linux px4-v2" + ["Tools/Replay"]="linux") + +build_concurrency=(["apm2"]="-j4" + ["navio"]="-j2" + ["sitl"]="-j4" + ["linux"]="-j2" + ["px4-v2"]="") + +build_extra_clean=(["px4-v2"]="make px4-cleandep") + +for d in "${!build_platforms[@]}"; do if ! travis_build_type_or_empty "$d"; then continue fi + pushd $d - make clean - make navio -j2 - make clean - make sitl -j4 - make clean - make linux -j2 - make clean - make px4-cleandep - make px4-v2 + for p in ${build_platforms["$d"]}; do + make clean + if [ ${build_extra_clean[$p]+_} ]; then + ${build_extra_clean[$p]} + fi + + make $p ${build_concurrency[$p]} + done popd done - -if travis_build_type_or_empty "Replay"; then - pushd Tools/Replay - make clean - make linux -j4 - popd -fi - -exit 0