]> granicus.if.org Git - esp-idf/commitdiff
Modified buid_examples.sh to handle new locations of examples
authorKrzysztof Budzynski <krzysztof@espressif.com>
Mon, 16 Jan 2017 22:08:35 +0000 (23:08 +0100)
committerKrzysztof Budzynski <krzysztof@espressif.com>
Mon, 16 Jan 2017 22:08:35 +0000 (23:08 +0100)
make/build_examples.sh

index ab5920879522d32434ea89b6ef47c1eab5ebcd27..e85ec26a70cd90dcd1e244c7fb840d446b58e344 100755 (executable)
@@ -15,34 +15,38 @@ FAILED_EXAMPLES=""
 
 RESULT_WARNINGS=22  # magic number result code for "warnings found"
 
-for example in ${IDF_PATH}/examples/*; do
-    [ -f ${example}/Makefile ] || continue
-    echo "Building ${example} as ${EXAMPLE_NUM}..."
-    mkdir -p example_builds/${EXAMPLE_NUM}
-    cp -r ${example} example_builds/${EXAMPLE_NUM}
-    pushd example_builds/${EXAMPLE_NUM}/`basename ${example}`
-
-   # be stricter in the CI build than the default IDF settings
-   export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
-   export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
-
-   # build non-verbose first
-   BUILDLOG=$(mktemp -t examplebuild.XXXX.log)
-   (
-       set -o pipefail  # so result of make all isn't lost when piping to tee
-       set -e
-       make clean defconfig
-       make $* all 2>&1 | tee $BUILDLOG
-    ) || { RESULT=$?; FAILED_EXAMPLES+=" ${example}"; make V=1; } # only build verbose if there's an error
-    popd
-    EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
-
-    if grep -q ": warning:" $BUILDLOG; then
-        [ $RESULT -eq 0 ] && RESULT=$RESULT_WARNINGS
-        FAILED_EXAMPLES+=" ${example} (warnings)"
-    fi
-
-    rm -f $BUILDLOG
+# traverse categories
+for category in ${IDF_PATH}/examples/*; do
+    # traverse examples within each category
+    for example in ${category}/*; do
+        [ -f ${example}/Makefile ] || continue
+        echo "Building ${example} as ${EXAMPLE_NUM}..."
+        mkdir -p example_builds/${EXAMPLE_NUM}
+        cp -r ${example} example_builds/${EXAMPLE_NUM}
+        pushd example_builds/${EXAMPLE_NUM}/`basename ${example}`
+
+        # be stricter in the CI build than the default IDF settings
+        export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
+        export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
+
+        # build non-verbose first
+        BUILDLOG=$(mktemp -t examplebuild.XXXX.log)
+        (
+            set -o pipefail  # so result of make all isn't lost when piping to tee
+            set -e
+            make clean defconfig
+            make $* all 2>&1 | tee $BUILDLOG
+        ) || { RESULT=$?; FAILED_EXAMPLES+=" ${example}"; make V=1; } # only build verbose if there's an error
+        popd
+        EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
+
+        if grep -q ": warning:" $BUILDLOG; then
+            [ $RESULT -eq 0 ] && RESULT=$RESULT_WARNINGS
+            FAILED_EXAMPLES+=" ${example} (warnings)"
+        fi
+
+        rm -f $BUILDLOG
+    done
 done
 
 if [ $RESULT -eq $RESULT_WARNINGS ]; then