From 8456cb4532dfa192ab42f3dd48dfccb46c73308a Mon Sep 17 00:00:00 2001
From: Gustavo Jose de Sousa <gustavo.sousa@intel.com>
Date: Fri, 27 Nov 2015 16:50:45 -0200
Subject: [PATCH] travis: support waf build

Currently, an associative array variable waf_supported_boards is used to
trigger waf build only the currently supported boards. After the transition to
the new build system is done, that variable can be removed.

We're just building for now - there is a current issue related to the rotation
for solo, and it turns out that the first unit test added as an example is for
vector rotations. After that is solved we can use waf check, so that unit tests
are run as well.
---
 Tools/scripts/build_all_travis.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Tools/scripts/build_all_travis.sh b/Tools/scripts/build_all_travis.sh
index 77eddf11a5..9a79e4df2f 100755
--- a/Tools/scripts/build_all_travis.sh
+++ b/Tools/scripts/build_all_travis.sh
@@ -15,6 +15,7 @@ fi
 declare -A build_platforms
 declare -A build_concurrency
 declare -A build_extra_clean
+declare -A waf_supported_boards
 
 build_platforms=(  ["ArduPlane"]="navio raspilot minlure sitl linux px4-v2"
                    ["ArduCopter"]="navio raspilot minlure sitl linux px4-v2 px4-v4"
@@ -32,8 +33,12 @@ build_concurrency=(["navio"]="-j2"
 
 build_extra_clean=(["px4-v2"]="make px4-cleandep")
 
+# get list of boards supported by the waf build
+for board in $(./waf list_boards | head -n1); do waf_supported_boards[$board]=1; done
+
 echo "Targets: $TRAVIS_BUILD_TARGET"
 for t in $TRAVIS_BUILD_TARGET; do
+    echo "Starting make based build for target ${t}..."
     for v in ${!build_platforms[@]}; do
         if [[ ${build_platforms[$v]} != *$t* ]]; then
             continue
@@ -49,4 +54,11 @@ for t in $TRAVIS_BUILD_TARGET; do
         make $t ${build_concurrency[$t]}
         popd
     done
+
+    if [[ -n ${waf_supported_boards[$t]} ]]; then
+        echo "Starting waf build for board ${t}..."
+        ./waf configure --board $t
+        ./waf clean
+        ./waf ${build_concurrency[$t]} build
+    fi
 done