apparently arrays can't be exported

This commit is contained in:
Todd Treece 2015-07-27 11:15:42 -04:00
parent 87d6e29cfe
commit 54d38a496a

View file

@ -7,10 +7,10 @@ if [ "${BASH_VERSION%%[^0-9]*}" -lt "4" ]; then
fi fi
# associative array for platforms that will be verified in build_main_platforms() # associative array for platforms that will be verified in build_main_platforms()
declare -x -A main_platforms=( [uno]="arduino:avr:uno" [due]="arduino:sam:arduino_due_x" [esp8266]="esp8266:esp8266:huzzah" [leonardo]="arduino:avr:leonardo" ) export main_p='declare -A main_platforms=( [uno]="arduino:avr:uno" [due]="arduino:sam:arduino_due_x" [esp8266]="esp8266:esp8266:huzzah" [leonardo]="arduino:avr:leonardo" )'
# associative array for other platforms that can be called explicitly in .travis.yml configs # associative array for other platforms that can be called explicitly in .travis.yml configs
declare -x -A aux_platforms=( [trinket]="adafruit:avr:trinket5" [gemma]="arduino:avr:gemma" ) export aux_p='declare -A aux_platforms=( [trinket]="adafruit:avr:trinket5" [gemma]="arduino:avr:gemma" )'
# 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
@ -42,6 +42,10 @@ arduino --install-library USBHost
function build_examples() function build_examples()
{ {
# arrays can't be exported, so we have to eval
eval $main_p
eval $aux_p
# expects argument 1 to be the platform key # expects argument 1 to be the platform key
local platform_key=$1 local platform_key=$1
@ -118,6 +122,10 @@ function build_examples()
function build_main_platforms() function build_main_platforms()
{ {
# arrays can't be exported, so we have to eval
eval $main_p
eval $aux_p
for p_key in "${!main_platforms[@]}"; do for p_key in "${!main_platforms[@]}"; do
# build all examples for this platform # build all examples for this platform