1
1
#! /bin/bash
2
2
3
- SDKCONFIG_DIR=" $ARDUINO_ESP32_PATH /tools/esp32-arduino-libs"
3
+ if [ -d " $ARDUINO_ESP32_PATH /tools/esp32-arduino-libs" ]; then
4
+ SDKCONFIG_DIR=" $ARDUINO_ESP32_PATH /tools/esp32-arduino-libs"
5
+ elif [ -d " $GITHUB_WORKSPACE /tools/esp32-arduino-libs" ]; then
6
+ SDKCONFIG_DIR=" $GITHUB_WORKSPACE /tools/esp32-arduino-libs"
7
+ else
8
+ SDKCONFIG_DIR=" tools/esp32-arduino-libs"
9
+ fi
4
10
5
11
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
6
12
while [ ! -z " $1 " ]; do
@@ -278,10 +284,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
278
284
unset options
279
285
}
280
286
281
- function count_sketches(){ # count_sketches <path> [target] [file]
287
+ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requirements]
282
288
local path=$1
283
289
local target=$2
284
- local file=$3
290
+ local ignore_requirements=$3
291
+ local file=$4
285
292
286
293
if [ $# -lt 1 ]; then
287
294
echo " ERROR: Illegal number of parameters"
@@ -294,7 +301,7 @@ function count_sketches(){ # count_sketches <path> [target] [file]
294
301
return 0
295
302
fi
296
303
297
- if [ -n " $file " ]; then
304
+ if [ -f " $file " ]; then
298
305
local sketches=$( cat $file )
299
306
else
300
307
local sketches=$( find $path -name * .ino | sort)
@@ -314,16 +321,18 @@ function count_sketches(){ # count_sketches <path> [target] [file]
314
321
continue
315
322
fi
316
323
317
- # Check if the sketch requires any configuration options
318
- requirements=$( jq -r ' .requires[]? // empty' $sketchdir /ci.json)
319
- if [[ " $requirements " != " null" ]] || [[ " $requirements " != " " ]]; then
320
- for requirement in $requirements ; do
321
- requirement=$( echo $requirement | xargs)
322
- found_line=$( grep -E " ^$requirement " $SDKCONFIG_DIR /$target /sdkconfig)
323
- if [[ " $found_line " == " " ]]; then
324
- continue 2
325
- fi
326
- done
324
+ if [ " $ignore_requirements " != " 1" ]; then
325
+ # Check if the sketch requires any configuration options
326
+ requirements=$( jq -r ' .requires[]? // empty' $sketchdir /ci.json)
327
+ if [[ " $requirements " != " null" ]] || [[ " $requirements " != " " ]]; then
328
+ for requirement in $requirements ; do
329
+ requirement=$( echo $requirement | xargs)
330
+ found_line=$( grep -E " ^$requirement " $SDKCONFIG_DIR /$target /sdkconfig)
331
+ if [[ " $found_line " == " " ]]; then
332
+ continue 2
333
+ fi
334
+ done
335
+ fi
327
336
fi
328
337
fi
329
338
echo $sketch >> sketches.txt
@@ -401,7 +410,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
401
410
402
411
set +e
403
412
if [ -n " $sketches_file " ]; then
404
- count_sketches " $path " " $target " " $sketches_file "
413
+ count_sketches " $path " " $target " " 0 " " $sketches_file "
405
414
local sketchcount=$?
406
415
else
407
416
count_sketches " $path " " $target "
0 commit comments