@@ -113,14 +113,31 @@ function print_sketch_info()
113
113
local build_rem=$2
114
114
115
115
local testcnt=0
116
+ local cnt=0
116
117
117
118
for sketch in $ESP8266_ARDUINO_SKETCHES ; do
118
119
testcnt=$(( ($testcnt + 1 ) % $build_mod ))
119
120
if [ $testcnt -ne $build_rem ]; then
120
121
continue # Not ours to do
121
122
fi
122
123
123
- echo $sketch
124
+ local sketchdir
125
+ sketchdir=$( dirname $sketch )
126
+
127
+ local sketchdirname
128
+ sketchdirname=$( basename $sketchdir )
129
+
130
+ local sketchname
131
+ sketchname=$( basename $sketch )
132
+
133
+ local skip
134
+ skip=$( skip_sketch " $sketch " " $sketchname " " $sketchdir " " $sketchdirname " )
135
+ if [ -n " $skip " ]; then
136
+ continue # Should be skipped / cannot be built
137
+ fi
138
+
139
+ cnt=$(( $cnt + 1 ))
140
+ printf ' %2d\t%s\n' " $cnt " " $sketch "
124
141
done
125
142
}
126
143
@@ -140,9 +157,10 @@ function build_sketches()
140
157
local core_path=$1
141
158
local cli_path=$2
142
159
local library_path=$3
143
- local build_mod=$4
144
- local build_rem=$5
145
- local lwip=$6
160
+ local lwip=$4
161
+ local build_mod=$5
162
+ local build_rem=$6
163
+ local build_cnt=$7
146
164
147
165
local build_dir=" $cache_dir " /build
148
166
mkdir -p " $build_dir "
@@ -163,53 +181,19 @@ function build_sketches()
163
181
164
182
print_size_info_header > " $cache_dir " /size.log
165
183
166
- local mk_clean_core =1
184
+ local clean_core =1
167
185
local testcnt=0
186
+ local cnt=0
168
187
169
188
for sketch in $ESP8266_ARDUINO_SKETCHES ; do
170
189
testcnt=$(( ($testcnt + 1 ) % $build_mod ))
171
190
if [ $testcnt -ne " $build_rem " ]; then
172
191
continue # Not ours to do
173
192
fi
174
193
175
- # mkbuildoptglobals.py is optimized around the Arduino IDE 1.x
176
- # behaviour. One way the CI differs from the Arduino IDE is in the
177
- # handling of core and caching core. With the Arduino IDE, each sketch
178
- # has a private copy of core and contributes to a core cache. With the
179
- # CI, there is one shared copy of core for all sketches. When global
180
- # options are used, the shared copy of core and cache are removed before
181
- # and after the build.
182
- #
183
194
# Do we need a clean core build? $build_dir/core/* cannot be shared
184
195
# between sketches when global options are present.
185
- if [ -s ${sketch} .globals.h ]; then
186
- mk_clean_core=1
187
- fi
188
- if [ $mk_clean_core -ne 0 ]; then
189
- rm -rf " $build_dir " /core/*
190
- else
191
- # Remove sketch specific files from ./core/ between builds.
192
- rm -rf " $build_dir /core/build.opt" " $build_dir " /core/* .ino.globals.h
193
- fi
194
-
195
- if [ -e ${build_dir} /core/* .a ]; then
196
- # We need to preserve the build.options.json file and replace the last .ino
197
- # with this sketch's ino file, or builder will throw everything away.
198
- jq ' ."sketchLocation" = "' $sketch ' "' $build_dir /build.options.json \
199
- > " $build_dir " /build.options.json.tmp
200
- mv " $build_dir " /build.options.json.tmp " $build_dir " /build.options.json
201
- if [ $mk_clean_core -ne 0 ]; then
202
- # Hack workaround for CI not handling core rebuild for global options
203
- rm ${build_dir} /core/* .a
204
- fi
205
- fi
206
-
207
- if [ -s ${sketch} .globals.h ]; then
208
- # Set to cleanup core at the start of the next build.
209
- mk_clean_core=1
210
- else
211
- mk_clean_core=0
212
- fi
196
+ clean_core=$( arduino_mkbuildoptglobals_cleanup " $clean_core " " $build_dir " " $sketch " )
213
197
214
198
# Clear out the last built sketch, map, elf, bin files, but leave the compiled
215
199
# objects in the core and libraries available for use so we don't need to rebuild
@@ -235,15 +219,23 @@ function build_sketches()
235
219
continue
236
220
fi
237
221
238
- echo ::group::Building $sketch
222
+ cnt=$(( $cnt + 1 ))
223
+ if [ $build_cnt != 0 ] ; then
224
+ if [ $build_cnt != $cnt ] ; then
225
+ continue
226
+ fi
227
+ build_cnt=0
228
+ fi
229
+
230
+ echo ::group::Building $cnt $sketch
239
231
echo " $build_cmd $sketch "
240
232
241
233
local result
242
234
time $build_cmd $sketch > " $cache_dir " /build.log \
243
235
&& result=0 || result=1
244
236
245
237
if [ $result -ne 0 ]; then
246
- echo ::error::Build failed for $sketch
238
+ echo ::error::Build failed for $cnt $ sketch
247
239
cat " $cache_dir /build.log"
248
240
echo ::endgroup::
249
241
return $result
@@ -455,18 +447,65 @@ function arduino_lwip_menu_option()
455
447
esac
456
448
}
457
449
458
- function build_sketches_with_arduino()
450
+ # mkbuildoptglobals.py is optimized around the Arduino IDE 1.x
451
+ # behaviour. One way the CI differs from the Arduino IDE is in the
452
+ # handling of core and caching core. With the Arduino IDE, each sketch
453
+ # has a private copy of core and contributes to a core cache. With the
454
+ # CI, there is one shared copy of core for all sketches. When global
455
+ # options are used, the shared copy of core and cache are removed before
456
+ # and after the build.
457
+ function arduino_mkbuildoptglobals_cleanup()
459
458
{
460
- local build_mod=$1
461
- local build_rem=$2
459
+ local clean_core=$1
460
+ local build_dir=$2
461
+ local sketch=$3
462
462
463
+ if [ -s ${sketch} .globals.h ]; then
464
+ clean_core=1
465
+ fi
466
+
467
+ # Remove sketch specific files from ./core/ between builds.
468
+ if [ $clean_core -ne 0 ]; then
469
+ rm -rf " $build_dir " /core/*
470
+ else
471
+ rm -rf " $build_dir /core/build.opt" " $build_dir " /core/* .ino.globals.h
472
+ fi
473
+
474
+ if [ -e ${build_dir} /core/* .a ]; then
475
+ # We need to preserve the build.options.json file and replace the last .ino
476
+ # with this sketch's ino file, or builder will throw everything away.
477
+ jq ' ."sketchLocation" = "' $sketch ' "' $build_dir /build.options.json \
478
+ > " $build_dir " /build.options.json.tmp
479
+ mv " $build_dir " /build.options.json.tmp " $build_dir " /build.options.json
480
+ if [ $clean_core -ne 0 ]; then
481
+ # Hack workaround for CI not handling core rebuild for global options
482
+ rm ${build_dir} /core/* .a
483
+ fi
484
+ fi
485
+
486
+ if [ -s ${sketch} .globals.h ]; then
487
+ # Set to cleanup core at the start of the next build.
488
+ clean_core=1
489
+ else
490
+ clean_core=0
491
+ fi
492
+
493
+ echo $clean_core
494
+ }
495
+
496
+ function build_sketches_with_arduino()
497
+ {
463
498
local lwip
464
- lwip=$( arduino_lwip_menu_option $3 )
499
+ lwip=$( arduino_lwip_menu_option $1 )
500
+
501
+ local build_mod=$2
502
+ local build_rem=$3
503
+ local build_cnt=$4
465
504
466
505
build_sketches " $ESP8266_ARDUINO_BUILD_DIR " \
467
506
" $ESP8266_ARDUINO_CLI " \
468
507
" $ESP8266_ARDUINO_LIBRARIES " \
469
- " $build_mod " " $build_rem " " $lwip "
508
+ " $lwip " " $ build_mod" " $build_rem " " $build_cnt "
470
509
step_summary " Size report" " $cache_dir /size.log"
471
510
}
472
511
@@ -510,6 +549,7 @@ function build_sketches_with_platformio()
510
549
{
511
550
local build_mod=$1
512
551
local build_rem=$2
552
+ local build_cnt=$3
513
553
local testcnt=0
514
554
515
555
for sketch in $ESP8266_ARDUINO_SKETCHES ; do
@@ -534,6 +574,14 @@ function build_sketches_with_platformio()
534
574
continue
535
575
fi
536
576
577
+ cnt=$(( $cnt + 1 ))
578
+ if [ $build_cnt != 0 ] ; then
579
+ if [ $build_cnt != $cnt ] ; then
580
+ continue
581
+ fi
582
+ build_cnt=0
583
+ fi
584
+
537
585
echo ::group::Building $sketch
538
586
539
587
local result
0 commit comments