@@ -98,34 +98,42 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
98
98
99
99
# Default FQBN options if none were passed in the command line.
100
100
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 } "
101
+ esp32_opts=" PSRAM=enabled${fqbn_append: +,$fqbn_append } "
102
+ esp32s2_opts=" PSRAM=enabled${fqbn_append: +,$fqbn_append } "
103
+ esp32s3_opts=" PSRAM=opi,USBMode=default${fqbn_append: +,$fqbn_append } "
104
+ esp32c3_opts=" $ fqbn_append"
105
+ esp32c6_opts=" $ fqbn_append"
106
+ esp32h2_opts=" $ fqbn_append"
107
107
108
108
# Select the common part of the FQBN based on the target. The rest will be
109
109
# appended depending on the passed options.
110
110
111
+ opt=" "
112
+
111
113
case " $target " in
112
114
" esp32" )
113
- fqbn=" espressif:esp32:esp32:${options:- $esp32_opts } "
115
+ [ -n " ${options:- $esp32_opts } " ] && opt=" :${options:- $esp32_opts } "
116
+ fqbn=" espressif:esp32:esp32$opt "
114
117
;;
115
118
" esp32s2" )
116
- fqbn=" espressif:esp32:esp32s2:${options:- $esp32s2_opts } "
119
+ [ -n " ${options:- $esp32s2_opts } " ] && opt=" :${options:- $esp32s2_opts } "
120
+ fqbn=" espressif:esp32:esp32s2$opt "
117
121
;;
118
122
" esp32c3" )
119
- fqbn=" espressif:esp32:esp32c3:${options:- $esp32c3_opts } "
123
+ [ -n " ${options:- $esp32c3_opts } " ] && opt=" :${options:- $esp32c3_opts } "
124
+ fqbn=" espressif:esp32:esp32c3$opt "
120
125
;;
121
126
" esp32s3" )
122
- fqbn=" espressif:esp32:esp32s3:${options:- $esp32s3_opts } "
127
+ [ -n " ${options:- $esp32s3_opts } " ] && opt=" :${options:- $esp32s3_opts } "
128
+ fqbn=" espressif:esp32:esp32s3$opt "
123
129
;;
124
130
" esp32c6" )
125
- fqbn=" espressif:esp32:esp32c6:${options:- $esp32c6_opts } "
131
+ [ -n " ${options:- $esp32c6_opts } " ] && opt=" :${options:- $esp32c6_opts } "
132
+ fqbn=" espressif:esp32:esp32c6$opt "
126
133
;;
127
134
" esp32h2" )
128
- fqbn=" espressif:esp32:esp32h2:${options:- $esp32h2_opts } "
135
+ [ -n " ${options:- $esp32h2_opts } " ] && opt=" :${options:- $esp32h2_opts } "
136
+ fqbn=" espressif:esp32:esp32h2$opt "
129
137
;;
130
138
esac
131
139
@@ -163,9 +171,9 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
163
171
exit 0
164
172
fi
165
173
166
- # Check if the sketch requires any configuration options
174
+ # Check if the sketch requires any configuration options (AND)
167
175
requirements=$( jq -r ' .requires[]? // empty' $sketchdir /ci.json)
168
- if [[ " $requirements " != " null" ]] || [[ " $requirements " != " " ]]; then
176
+ if [[ " $requirements " != " null" && " $requirements " != " " ]]; then
169
177
for requirement in $requirements ; do
170
178
requirement=$( echo $requirement | xargs)
171
179
found_line=$( grep -E " ^$requirement " " $SDKCONFIG_DIR /$target /sdkconfig" )
@@ -175,6 +183,24 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
175
183
fi
176
184
done
177
185
fi
186
+
187
+ # Check if the sketch excludes any configuration options (OR)
188
+ requirements_or=$( jq -r ' .requires_any[]? // empty' $sketchdir /ci.json)
189
+ if [[ " $requirements_or " != " null" && " $requirements_or " != " " ]]; then
190
+ found=false
191
+ for requirement in $requirements_or ; do
192
+ requirement=$( echo $requirement | xargs)
193
+ found_line=$( grep -E " ^$requirement " " $SDKCONFIG_DIR /$target /sdkconfig" )
194
+ if [[ " $found_line " != " " ]]; then
195
+ found=true
196
+ break
197
+ fi
198
+ done
199
+ if [[ " $found " == " false" ]]; then
200
+ echo " Target $target meets none of the requirements in requires_any for $sketchname . Skipping."
201
+ exit 0
202
+ fi
203
+ fi
178
204
fi
179
205
180
206
ARDUINO_CACHE_DIR=" $HOME /.arduino/cache.tmp"
@@ -213,9 +239,9 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
213
239
--build-cache-path " $ARDUINO_CACHE_DIR " \
214
240
--build-path " $build_dir " \
215
241
$xtra_opts " ${sketchdir} " \
216
- > $output_file
242
+ 2>&1 | tee $output_file
217
243
218
- exit_status=$?
244
+ exit_status=${PIPESTATUS[0]}
219
245
if [ $exit_status -ne 0 ]; then
220
246
echo " ERROR: Compilation failed with error code $exit_status "
221
247
exit $exit_status
@@ -322,9 +348,9 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi
322
348
fi
323
349
324
350
if [ " $ignore_requirements " != " 1" ]; then
325
- # Check if the sketch requires any configuration options
351
+ # Check if the sketch requires any configuration options (AND)
326
352
requirements=$( jq -r ' .requires[]? // empty' $sketchdir /ci.json)
327
- if [[ " $requirements " != " null" ]] || [[ " $requirements " != " " ]]; then
353
+ if [[ " $requirements " != " null" && " $requirements " != " " ]]; then
328
354
for requirement in $requirements ; do
329
355
requirement=$( echo $requirement | xargs)
330
356
found_line=$( grep -E " ^$requirement " $SDKCONFIG_DIR /$target /sdkconfig)
@@ -333,6 +359,23 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi
333
359
fi
334
360
done
335
361
fi
362
+
363
+ # Check if the sketch excludes any configuration options (OR)
364
+ requirements_or=$( jq -r ' .requires_any[]? // empty' $sketchdir /ci.json)
365
+ if [[ " $requirements_or " != " null" && " $requirements_or " != " " ]]; then
366
+ found=false
367
+ for requirement in $requirements_or ; do
368
+ requirement=$( echo $requirement | xargs)
369
+ found_line=$( grep -E " ^$requirement " $SDKCONFIG_DIR /$target /sdkconfig)
370
+ if [[ " $found_line " != " " ]]; then
371
+ found=true
372
+ break
373
+ fi
374
+ done
375
+ if [[ " $found " == " false" ]]; then
376
+ continue 2
377
+ fi
378
+ fi
336
379
fi
337
380
fi
338
381
echo $sketch >> sketches.txt
0 commit comments