@@ -769,68 +769,68 @@ function build_sketch()
769
769
770
770
if [[ " $ARDUINO_CI_SCRIPT_GENERATED_IDE_VERSION_LIST_ARRAY " == " $ARDUINO_CI_SCRIPT_IDE_VERSION_LIST_ARRAY_DECLARATION " ' ()' ]]; then
771
771
echo " ERROR: The IDE version(s) specified are not installed"
772
- return_handler " $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
773
- fi
774
-
775
- eval " $ARDUINO_CI_SCRIPT_GENERATED_IDE_VERSION_LIST_ARRAY "
776
- local IDEversion
777
- for IDEversion in " ${IDEversionListArray[@]} " ; do
778
- # Install the IDE
779
- # This must be done before searching for sketches in case the path specified is in the Arduino IDE installation folder
780
- install_ide_version " $IDEversion "
781
-
782
- # The package_index files installed by some versions of the IDE (1.6.5, 1.6.5) can cause compilation to fail for other versions (1.6.5-r4, 1.6.5-r5). Attempting to install a dummy package ensures that the correct version of those files will be installed before the sketch verification.
783
- # Check if the newest installed IDE version supports --install-boards
784
- local unsupportedInstallBoardsOptionVersionsRange1regex =" ^1\.5 \.[0-9 ]$"
785
- local unsupportedInstallBoardsOptionVersionsRange2regex= " ^1\.6\.[0-3]$ "
786
- if ! [[ " $IDEversion " =~ $unsupportedInstallBoardsOptionVersionsRange1regex || " $IDEversion " =~ $unsupportedInstallBoardsOptionVersionsRange2regex ]] ; then
787
- # shellcheck disable=SC2086
788
- eval \" ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} / ${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} / ${ARDUINO_CI_SCRIPT_ARDUINO_COMMAND} \ " --install-boards arduino:dummy " $ARDUINO_CI_SCRIPT_VERBOSITY_REDIRECT "
789
- if [[ " $ARDUINO_CI_SCRIPT_VERBOSITY_LEVEL " -gt 1 ]] ; then
790
- # The warning is printed to stdout
791
- echo " NOTE: The warning above \" Selected board is not available \" is caused intentionally and does not indicate a problem. "
772
+ buildSketchExitStatus= " $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
773
+ else
774
+ eval " $ARDUINO_CI_SCRIPT_GENERATED_IDE_VERSION_LIST_ARRAY "
775
+ local IDEversion
776
+ for IDEversion in " ${IDEversionListArray[@]} " ; do
777
+ # Install the IDE
778
+ # This must be done before searching for sketches in case the path specified is in the Arduino IDE installation folder
779
+ install_ide_version " $IDEversion "
780
+
781
+ # The package_index files installed by some versions of the IDE (1.6.5, 1.6.5) can cause compilation to fail for other versions (1.6.5-r4, 1.6.5-r5). Attempting to install a dummy package ensures that the correct version of those files will be installed before the sketch verification.
782
+ # Check if the newest installed IDE version supports -- install-boards
783
+ local unsupportedInstallBoardsOptionVersionsRange1regex= " ^1\.5\.[0-9]$ "
784
+ local unsupportedInstallBoardsOptionVersionsRange2regex =" ^1\.6 \.[0-3 ]$"
785
+ if ! [[ " $IDEversion " =~ $unsupportedInstallBoardsOptionVersionsRange1regex || " $IDEversion " =~ $unsupportedInstallBoardsOptionVersionsRange2regex ]] ; then
786
+ # shellcheck disable=SC2086
787
+ eval \" ${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER} / ${ARDUINO_CI_SCRIPT_IDE_INSTALLATION_FOLDER} / ${ARDUINO_CI_SCRIPT_ARDUINO_COMMAND} \" --install-boards arduino:dummy " $ARDUINO_CI_SCRIPT_VERBOSITY_REDIRECT "
788
+ if [[ " $ARDUINO_CI_SCRIPT_VERBOSITY_LEVEL " -gt 1 ]] ; then
789
+ # The warning is printed to stdout
790
+ echo " NOTE: The warning above \" Selected board is not available \" is caused intentionally and does not indicate a problem. "
791
+ fi
792
792
fi
793
- fi
794
793
795
- if [[ " $sketchPath " =~ \. ino$ || " $sketchPath " =~ \. pde$ ]]; then
796
- # A sketch was specified
797
- if ! [[ -f " $sketchPath " ]]; then
798
- echo " ERROR: Specified sketch: $sketchPath doesn't exist"
799
- buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
800
- elif ! build_this_sketch " $sketchPath " " $boardID " " $IDEversion " " $allowFail " ; then
801
- # build_this_sketch returned a non-zero exit status
802
- buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
803
- fi
804
- else
805
- # Search for all sketches in the path and put them in an array
806
- local sketchFound=" false"
807
- # https://github.com/koalaman/shellcheck/wiki/SC2207
808
- declare -a sketches
809
- mapfile -t sketches < <( find " $sketchPath " -name " *.pde" -o -name " *.ino" )
810
- local sketchName
811
- for sketchName in " ${sketches[@]} " ; do
812
- # Only verify the sketch that matches the name of the sketch folder, otherwise it will cause redundant verifications for sketches that have multiple .ino files
813
- local sketchFolder
814
- sketchFolder=" $( echo " $sketchName " | rev | cut -d' /' -f 2 | rev) "
815
- local sketchNameWithoutPathWithExtension
816
- sketchNameWithoutPathWithExtension=" $( echo " $sketchName " | rev | cut -d' /' -f 1 | rev) "
817
- local sketchNameWithoutPathWithoutExtension
818
- sketchNameWithoutPathWithoutExtension=" ${sketchNameWithoutPathWithExtension% .* } "
819
- if [[ " $sketchFolder " == " $sketchNameWithoutPathWithoutExtension " ]]; then
820
- sketchFound=" true"
821
- if ! build_this_sketch " $sketchName " " $boardID " " $IDEversion " " $allowFail " ; then
822
- # build_this_sketch returned a non-zero exit status
823
- buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
824
- fi
794
+ if [[ " $sketchPath " =~ \. ino$ || " $sketchPath " =~ \. pde$ ]]; then
795
+ # A sketch was specified
796
+ if ! [[ -f " $sketchPath " ]]; then
797
+ echo " ERROR: Specified sketch: $sketchPath doesn't exist"
798
+ buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
799
+ elif ! build_this_sketch " $sketchPath " " $boardID " " $IDEversion " " $allowFail " ; then
800
+ # build_this_sketch returned a non-zero exit status
801
+ buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
825
802
fi
826
- done
803
+ else
804
+ # Search for all sketches in the path and put them in an array
805
+ local sketchFound=" false"
806
+ # https://github.com/koalaman/shellcheck/wiki/SC2207
807
+ declare -a sketches
808
+ mapfile -t sketches < <( find " $sketchPath " -name " *.pde" -o -name " *.ino" )
809
+ local sketchName
810
+ for sketchName in " ${sketches[@]} " ; do
811
+ # Only verify the sketch that matches the name of the sketch folder, otherwise it will cause redundant verifications for sketches that have multiple .ino files
812
+ local sketchFolder
813
+ sketchFolder=" $( echo " $sketchName " | rev | cut -d' /' -f 2 | rev) "
814
+ local sketchNameWithoutPathWithExtension
815
+ sketchNameWithoutPathWithExtension=" $( echo " $sketchName " | rev | cut -d' /' -f 1 | rev) "
816
+ local sketchNameWithoutPathWithoutExtension
817
+ sketchNameWithoutPathWithoutExtension=" ${sketchNameWithoutPathWithExtension% .* } "
818
+ if [[ " $sketchFolder " == " $sketchNameWithoutPathWithoutExtension " ]]; then
819
+ sketchFound=" true"
820
+ if ! build_this_sketch " $sketchName " " $boardID " " $IDEversion " " $allowFail " ; then
821
+ # build_this_sketch returned a non-zero exit status
822
+ buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
823
+ fi
824
+ fi
825
+ done
827
826
828
- if [[ " $sketchFound " == " false" ]]; then
829
- echo " ERROR: No valid sketches were found in the specified path"
830
- buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
827
+ if [[ " $sketchFound " == " false" ]]; then
828
+ echo " ERROR: No valid sketches were found in the specified path"
829
+ buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
830
+ fi
831
831
fi
832
- fi
833
- done
832
+ done
833
+ fi
834
834
835
835
disable_verbosity
836
836
0 commit comments