From 989a55cead4c0b1f9578f1f175c071c9e31aaf89 Mon Sep 17 00:00:00 2001 From: Brennen Bearnes Date: Mon, 7 Jan 2019 17:43:26 -0700 Subject: [PATCH 1/2] add PLATFORM_CHECK_ONLY_ON_FILE environment var for limiting arduino checks --- install.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 19732b91..52ae3b2e 100644 --- a/install.sh +++ b/install.sh @@ -154,8 +154,20 @@ function build_platform() # grab all pde and ino example sketches declare -a examples - # loop through results and add them to the array - examples=($(find $PWD -name "*.pde" -o -name "*.ino")) + if [ "$PLATFORM_CHECK_ONLY_ON_FILE" = true ]; then + # loop through results and add them to the array + examples=($( + for f in $(find . -type f -iname '*.ino' -o -iname '*.pde'); do + # TODO: distinguish platforms + if [ -e "$(dirname $f)/.$platform_key.test" ]; then + echo "$f" + fi + done + )) + else + # loop through results and add them to the array + examples=($(find $PWD -name "*.pde" -o -name "*.ino")) + fi # get the last example in the array local last="${examples[@]:(-1)}" From c06ae767e4268d0e94bba92de18eee8fc05fd46a Mon Sep 17 00:00:00 2001 From: Brennen Bearnes Date: Tue, 8 Jan 2019 13:22:32 -0700 Subject: [PATCH 2/2] add build_aux_platforms() --- install.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 52ae3b2e..a671d975 100644 --- a/install.sh +++ b/install.sh @@ -348,7 +348,7 @@ function build_platform() } -# build all examples for every platform in $main_platforms +# build all examples for every platform in $MAIN_PLATFORMS function build_main_platforms() { @@ -397,6 +397,54 @@ function build_main_platforms() } +# build all examples for every platform in $AUX_PLATFORMS +function build_aux_platforms() +{ + + # arrays can't be exported, so we have to eval + eval $AUX_PLATFORMS + + # track the build status all platforms + local exit_code=0 + + # var to hold platforms + local platforms_json="" + + # get the last element in the array + local last="${aux_platforms[@]:(-1)}" + + # loop through platforms in main platforms assoc array + for p_key in "${!aux_platforms[@]}"; do + + # is this the last platform in the loop + local last_platform=0 + if [ "$last" == "${aux_platforms[$p_key]}" ]; then + last_platform=1 + fi + + # build all examples for this platform + build_platform $p_key + + # check if build failed + if [ $? -ne 0 ]; then + platforms_json="${platforms_json}$(json_platform $p_key 0 "$PLATFORM_JSON" $last_platform)" + exit_code=1 + else + platforms_json="${platforms_json}$(json_platform $p_key 1 "$PLATFORM_JSON" $last_platform)" + fi + + done + + # exit code is opposite of json build status + if [ $exit_code -eq 0 ]; then + json_main_platforms 1 "$platforms_json" + else + json_main_platforms 0 "$platforms_json" + fi + + return $exit_code + +} function build_cplay_platforms() {