Skip to content

Commit 1f99208

Browse files
authored
Merge pull request espressif#24 from adafruit/io-platforms
add io platforms
2 parents d961751 + 28a670a commit 1f99208

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

install.sh

+53
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export SAMD_PLATFORMS='declare -A samd_platforms=( [zero]="arduino:samd:arduino_
2121

2222
export M4_PLATFORMS='declare -A m4_platforms=( [m4]="adafruit:samd:adafruit_metro_m4" )'
2323

24+
export IO_PLATFORMS='declare -A io_platforms=( [zero]="arduino:samd:arduino_zero_native" [esp8266]="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80" [esp32]="espressif:esp32:featheresp32:FlashFreq=80" )'
25+
2426
# make display available for arduino CLI
2527
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
2628
sleep 3
@@ -106,6 +108,7 @@ function build_platform()
106108
eval $AUX_PLATFORMS
107109
eval $CPLAY_PLATFORMS
108110
eval $M4_PLATFORMS
111+
eval $IO_PLATFORMS
109112

110113
# reset platform json var
111114
PLATFORM_JSON=""
@@ -137,6 +140,8 @@ function build_platform()
137140
platform=${cplay_platforms[$platform_key]}
138141
elif [[ ${m4_platforms[$platform_key]} ]]; then
139142
platform=${m4_platforms[$platform_key]}
143+
elif [[ ${io_platforms[$platform_key]} ]]; then
144+
platform=${io_platforms[$platform_key]}
140145
else
141146
echo "NON-STANDARD PLATFORM KEY: $platform_key"
142147
platform=$platform_key
@@ -494,6 +499,54 @@ function build_m4_platforms()
494499

495500
}
496501

502+
function build_io_platforms()
503+
{
504+
505+
# arrays can't be exported, so we have to eval
506+
eval $IO_PLATFORMS
507+
508+
# track the build status all platforms
509+
local exit_code=0
510+
511+
# var to hold platforms
512+
local platforms_json=""
513+
514+
# get the last element in the array
515+
local last="${io_platforms[@]:(-1)}"
516+
517+
# loop through platforms in main platforms assoc array
518+
for p_key in "${!io_platforms[@]}"; do
519+
520+
# is this the last platform in the loop
521+
local last_platform=0
522+
if [ "$last" == "${io_platforms[$p_key]}" ]; then
523+
last_platform=1
524+
fi
525+
526+
# build all examples for this platform
527+
build_platform $p_key
528+
529+
# check if build failed
530+
if [ $? -ne 0 ]; then
531+
platforms_json="${platforms_json}$(json_platform $p_key 0 "$PLATFORM_JSON" $last_platform)"
532+
exit_code=1
533+
else
534+
platforms_json="${platforms_json}$(json_platform $p_key 1 "$PLATFORM_JSON" $last_platform)"
535+
fi
536+
537+
done
538+
539+
# exit code is opposite of json build status
540+
if [ $exit_code -eq 0 ]; then
541+
json_main_platforms 1 "$platforms_json"
542+
else
543+
json_main_platforms 0 "$platforms_json"
544+
fi
545+
546+
return $exit_code
547+
548+
}
549+
497550
# generate json string for a sketch
498551
function json_sketch()
499552
{

0 commit comments

Comments
 (0)