1
1
#! /bin/bash
2
2
3
- LIBS_DIR=" 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
@@ -83,15 +89,22 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
83
89
84
90
len=1
85
91
92
+ if [ -f $sketchdir /ci.json ]; then
93
+ fqbn_append=` jq -r ' .fqbn_append' $sketchdir /ci.json`
94
+ if [ $fqbn_append == " null" ]; then
95
+ fqbn_append=" "
96
+ fi
97
+ fi
98
+
86
99
# Default FQBN options if none were passed in the command line.
87
100
88
- esp32_opts=" PSRAM=enabled,PartitionScheme=huge_app, FlashMode=dio"
89
- esp32s2_opts=" PSRAM=enabled,PartitionScheme=huge_app, FlashMode=dio"
90
- esp32s3_opts=" PSRAM=opi,USBMode=default,PartitionScheme=huge_app, FlashMode=dio"
91
- esp32c3_opts=" PartitionScheme=huge_app, FlashMode=dio"
92
- esp32c6_opts=" PartitionScheme=huge_app, FlashMode=dio"
93
- esp32h2_opts=" PartitionScheme=huge_app, FlashMode=dio"
94
- esp32p4_opts=" PartitionScheme=huge_app, FlashMode=dio,USBMode=default"
101
+ esp32_opts=" PSRAM=enabled,FlashMode=dio${fqbn_append : +, $fqbn_append } "
102
+ esp32s2_opts=" PSRAM=enabled,FlashMode=dio${fqbn_append : +, $fqbn_append } "
103
+ esp32s3_opts=" PSRAM=opi,USBMode=default,FlashMode=dio${fqbn_append : +, $fqbn_append } "
104
+ esp32c3_opts=" FlashMode=dio${fqbn_append : +, $fqbn_append } "
105
+ esp32c6_opts=" FlashMode=dio${fqbn_append : +, $fqbn_append } "
106
+ esp32h2_opts=" FlashMode=dio${fqbn_append : +, $fqbn_append } "
107
+ esp32p4_opts=" FlashMode=dio,USBMode=default${fqbn_append : +, $fqbn_append } "
95
108
96
109
# Select the common part of the FQBN based on the target. The rest will be
97
110
# appended depending on the passed options.
@@ -158,7 +171,8 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
158
171
requirements=$( jq -r ' .requires[]? // empty' $sketchdir /ci.json)
159
172
if [[ " $requirements " != " null" ]] || [[ " $requirements " != " " ]]; then
160
173
for requirement in $requirements ; do
161
- found_line=$( grep -E " ^$requirement " $LIBS_DIR /$target /sdkconfig)
174
+ requirement=$( echo $requirement | xargs)
175
+ found_line=$( grep -E " ^$requirement " " $SDKCONFIG_DIR /$target /sdkconfig" )
162
176
if [[ " $found_line " == " " ]]; then
163
177
echo " Target $target does not meet the requirement $requirement for $sketchname . Skipping."
164
178
exit 0
@@ -274,10 +288,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
274
288
unset options
275
289
}
276
290
277
- function count_sketches(){ # count_sketches <path> [target] [file]
291
+ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requirements]
278
292
local path=$1
279
293
local target=$2
280
- local file=$3
294
+ local ignore_requirements=$3
295
+ local file=$4
281
296
282
297
if [ $# -lt 1 ]; then
283
298
echo " ERROR: Illegal number of parameters"
@@ -290,7 +305,7 @@ function count_sketches(){ # count_sketches <path> [target] [file]
290
305
return 0
291
306
fi
292
307
293
- if [ -n " $file " ]; then
308
+ if [ -f " $file " ]; then
294
309
local sketches=$( cat $file )
295
310
else
296
311
local sketches=$( find $path -name * .ino | sort)
@@ -310,15 +325,18 @@ function count_sketches(){ # count_sketches <path> [target] [file]
310
325
continue
311
326
fi
312
327
313
- # Check if the sketch requires any configuration options
314
- requirements=$( jq -r ' .requires[]? // empty' $sketchdir /ci.json)
315
- if [[ " $requirements " != " null" ]] || [[ " $requirements " != " " ]]; then
316
- for requirement in $requirements ; do
317
- found_line=$( grep -E " ^$requirement " $LIBS_DIR /$target /sdkconfig)
318
- if [[ " $found_line " == " " ]]; then
319
- continue 2
320
- fi
321
- done
328
+ if [ " $ignore_requirements " != " 1" ]; then
329
+ # Check if the sketch requires any configuration options
330
+ requirements=$( jq -r ' .requires[]? // empty' $sketchdir /ci.json)
331
+ if [[ " $requirements " != " null" ]] || [[ " $requirements " != " " ]]; then
332
+ for requirement in $requirements ; do
333
+ requirement=$( echo $requirement | xargs)
334
+ found_line=$( grep -E " ^$requirement " $SDKCONFIG_DIR /$target /sdkconfig)
335
+ if [[ " $found_line " == " " ]]; then
336
+ continue 2
337
+ fi
338
+ done
339
+ fi
322
340
fi
323
341
fi
324
342
echo $sketch >> sketches.txt
@@ -396,7 +414,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
396
414
397
415
set +e
398
416
if [ -n " $sketches_file " ]; then
399
- count_sketches " $path " " $target " " $sketches_file "
417
+ count_sketches " $path " " $target " " 0 " " $sketches_file "
400
418
local sketchcount=$?
401
419
else
402
420
count_sketches " $path " " $target "
0 commit comments