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