11#! /bin/bash
22
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
410
511function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
612 while [ ! -z " $1 " ]; do
@@ -278,10 +284,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
278284 unset options
279285}
280286
281- function count_sketches(){ # count_sketches <path> [target] [file]
287+ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requirements]
282288 local path=$1
283289 local target=$2
284290 local file=$3
291+ local ignore_requirements=$4
285292
286293 if [ $# -lt 1 ]; then
287294 echo " ERROR: Illegal number of parameters"
@@ -294,7 +301,7 @@ function count_sketches(){ # count_sketches <path> [target] [file]
294301 return 0
295302 fi
296303
297- if [ -n " $file " ]; then
304+ if [ -f " $file " ]; then
298305 local sketches=$( cat $file )
299306 else
300307 local sketches=$( find $path -name * .ino | sort)
@@ -314,16 +321,18 @@ function count_sketches(){ # count_sketches <path> [target] [file]
314321 continue
315322 fi
316323
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
327336 fi
328337 fi
329338 echo $sketch >> sketches.txt
0 commit comments