DM: adding cplay platforms
This commit is contained in:
parent
4032a628f6
commit
00c74e0422
1 changed files with 53 additions and 0 deletions
53
install.sh
53
install.sh
|
|
@ -14,6 +14,8 @@ export MAIN_PLATFORMS='declare -A main_platforms=( [uno]="arduino:avr:uno" [due]
|
||||||
# this will be eval'd in the functions below because arrays can't be exported
|
# this will be eval'd in the functions below because arrays can't be exported
|
||||||
export AUX_PLATFORMS='declare -A aux_platforms=( [trinket]="adafruit:avr:trinket5" [gemma]="arduino:avr:gemma" )'
|
export AUX_PLATFORMS='declare -A aux_platforms=( [trinket]="adafruit:avr:trinket5" [gemma]="arduino:avr:gemma" )'
|
||||||
|
|
||||||
|
export CPLAY_PLATFORMS='declare -A cplay_platforms=( [cplayClassic]="arduino:avr:circuitplay32u4cat" [cplayExpress]="arduino:samd:adafruit_circuitplayground_m0" ) '
|
||||||
|
|
||||||
# make display available for arduino CLI
|
# make display available for arduino CLI
|
||||||
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
|
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
@ -83,6 +85,7 @@ function build_platform()
|
||||||
# arrays can't be exported, so we have to eval
|
# arrays can't be exported, so we have to eval
|
||||||
eval $MAIN_PLATFORMS
|
eval $MAIN_PLATFORMS
|
||||||
eval $AUX_PLATFORMS
|
eval $AUX_PLATFORMS
|
||||||
|
eval $CPLAY_PLATFORMS
|
||||||
|
|
||||||
# reset platform json var
|
# reset platform json var
|
||||||
PLATFORM_JSON=""
|
PLATFORM_JSON=""
|
||||||
|
|
@ -110,6 +113,8 @@ function build_platform()
|
||||||
platform=${main_platforms[$platform_key]}
|
platform=${main_platforms[$platform_key]}
|
||||||
elif [[ ${aux_platforms[$platform_key]} ]]; then
|
elif [[ ${aux_platforms[$platform_key]} ]]; then
|
||||||
platform=${aux_platforms[$platform_key]}
|
platform=${aux_platforms[$platform_key]}
|
||||||
|
elif [[ ${cplay_platforms[$platform_key]} ]]; then
|
||||||
|
platform=${cplay_platforms[$platform_key]}
|
||||||
else
|
else
|
||||||
echo "NON-STANDARD PLATFORM KEY: $platform_key"
|
echo "NON-STANDARD PLATFORM KEY: $platform_key"
|
||||||
platform=$platform_key
|
platform=$platform_key
|
||||||
|
|
@ -323,6 +328,54 @@ function build_main_platforms()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function build_cplay_platforms()
|
||||||
|
{
|
||||||
|
|
||||||
|
# arrays can't be exported, so we have to eval
|
||||||
|
eval $CPLAY_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="${cplay_platforms[@]:(-1)}"
|
||||||
|
|
||||||
|
# loop through platforms in main platforms assoc array
|
||||||
|
for p_key in "${!cplay_platforms[@]}"; do
|
||||||
|
|
||||||
|
# is this the last platform in the loop
|
||||||
|
local last_platform=0
|
||||||
|
if [ "$last" == "${cplay_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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
# generate json string for a sketch
|
# generate json string for a sketch
|
||||||
function json_sketch()
|
function json_sketch()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue