Skip to content

Commit 7f78883

Browse files
brennenladyada
authored andcommitted
add PLATFORM_CHECK_ONLY_ON_FILE environment var for limiting arduino checks (espressif#36)
* add PLATFORM_CHECK_ONLY_ON_FILE environment var for limiting arduino checks * add build_aux_platforms()
1 parent 905dfd1 commit 7f78883

File tree

1 file changed

+63
-3
lines changed

1 file changed

+63
-3
lines changed

install.sh

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,20 @@ function build_platform()
154154
# grab all pde and ino example sketches
155155
declare -a examples
156156

157-
# loop through results and add them to the array
158-
examples=($(find $PWD -name "*.pde" -o -name "*.ino"))
157+
if [ "$PLATFORM_CHECK_ONLY_ON_FILE" = true ]; then
158+
# loop through results and add them to the array
159+
examples=($(
160+
for f in $(find . -type f -iname '*.ino' -o -iname '*.pde'); do
161+
# TODO: distinguish platforms
162+
if [ -e "$(dirname $f)/.$platform_key.test" ]; then
163+
echo "$f"
164+
fi
165+
done
166+
))
167+
else
168+
# loop through results and add them to the array
169+
examples=($(find $PWD -name "*.pde" -o -name "*.ino"))
170+
fi
159171

160172
# get the last example in the array
161173
local last="${examples[@]:(-1)}"
@@ -336,7 +348,7 @@ function build_platform()
336348

337349
}
338350

339-
# build all examples for every platform in $main_platforms
351+
# build all examples for every platform in $MAIN_PLATFORMS
340352
function build_main_platforms()
341353
{
342354

@@ -385,6 +397,54 @@ function build_main_platforms()
385397

386398
}
387399

400+
# build all examples for every platform in $AUX_PLATFORMS
401+
function build_aux_platforms()
402+
{
403+
404+
# arrays can't be exported, so we have to eval
405+
eval $AUX_PLATFORMS
406+
407+
# track the build status all platforms
408+
local exit_code=0
409+
410+
# var to hold platforms
411+
local platforms_json=""
412+
413+
# get the last element in the array
414+
local last="${aux_platforms[@]:(-1)}"
415+
416+
# loop through platforms in main platforms assoc array
417+
for p_key in "${!aux_platforms[@]}"; do
418+
419+
# is this the last platform in the loop
420+
local last_platform=0
421+
if [ "$last" == "${aux_platforms[$p_key]}" ]; then
422+
last_platform=1
423+
fi
424+
425+
# build all examples for this platform
426+
build_platform $p_key
427+
428+
# check if build failed
429+
if [ $? -ne 0 ]; then
430+
platforms_json="${platforms_json}$(json_platform $p_key 0 "$PLATFORM_JSON" $last_platform)"
431+
exit_code=1
432+
else
433+
platforms_json="${platforms_json}$(json_platform $p_key 1 "$PLATFORM_JSON" $last_platform)"
434+
fi
435+
436+
done
437+
438+
# exit code is opposite of json build status
439+
if [ $exit_code -eq 0 ]; then
440+
json_main_platforms 1 "$platforms_json"
441+
else
442+
json_main_platforms 0 "$platforms_json"
443+
fi
444+
445+
return $exit_code
446+
447+
}
388448
function build_cplay_platforms()
389449
{
390450

0 commit comments

Comments
 (0)