@@ -107,32 +107,42 @@ END {
107
107
awk -v sketch_name=" ${elf_name% .* } " " $awk_script " -
108
108
}
109
109
110
+ function format_fqbn()
111
+ {
112
+ local board_name=$1
113
+ local flash_size=$2
114
+ local lwip=$3
115
+
116
+ echo " esp8266com:esp8266:${board_name} :" \
117
+ " eesz=${flash_size} ," \
118
+ " ip=${lwip} "
119
+ }
120
+
110
121
function build_sketches()
111
122
{
112
123
local core_path=$1
113
- local ide_path=$2
114
- local hardware_path=$3
115
- local library_path=$4
116
- local build_mod=$5
117
- local build_rem=$6
118
- local lwip=$7
124
+ local cli_path=$2
125
+ local library_path=$3
126
+ local build_mod=$4
127
+ local build_rem=$5
128
+ local lwip=$6
119
129
120
130
local build_dir=" $cache_dir " /build
121
131
mkdir -p " $build_dir "
122
132
123
- local build_cache=" $cache_dir " /cache
124
- mkdir -p " $build_cache "
133
+ local build_out=" $cache_dir " /out
134
+ mkdir -p " $build_out "
135
+
136
+ local fqbn=$( format_fqbn " generic" " 4M1M" " $lwip " )
137
+ echo $fqbn
125
138
126
139
local build_cmd
127
- build_cmd=" python3 tools/build.py" \
128
- " --build_cache $build_cache " \
129
- " --build_path $build_dir " \
130
- " --hardware_path $hardware_path " \
131
- " --ide_path $ide_path " \
132
- " --library_path $library_path " \
133
- " --lwIP $lwip " \
134
- " --board_name generic --verbose --warnings all" \
135
- " --flash_size 4M1M --keep"
140
+ build_cmd+=${cli_path}
141
+ build_cmd+=" compile" \
142
+ " --build-path $build_dir " \
143
+ " --fqbn $fqbn " \
144
+ " --libraries $library_path " \
145
+ " --output-dir $build_out "
136
146
137
147
print_size_info_header > " $cache_dir " /size.log
138
148
@@ -165,15 +175,15 @@ function build_sketches()
165
175
rm -rf " $build_dir /core/build.opt" " $build_dir " /core/* .ino.globals.h
166
176
fi
167
177
168
- if [ -e $cache_dir /core/* .a ]; then
178
+ if [ -e ${build_dir} /core/* .a ]; then
169
179
# We need to preserve the build.options.json file and replace the last .ino
170
180
# with this sketch's ino file, or builder will throw everything away.
171
181
jq ' ."sketchLocation" = "' $sketch ' "' $build_dir /build.options.json \
172
182
> " $build_dir " /build.options.json.tmp
173
183
mv " $build_dir " /build.options.json.tmp " $build_dir " /build.options.json
174
184
if [ $mk_clean_core -ne 0 ]; then
175
185
# Hack workaround for CI not handling core rebuild for global options
176
- rm $cache_dir /core/* .a
186
+ rm ${build_dir} /core/* .a
177
187
fi
178
188
fi
179
189
@@ -305,40 +315,42 @@ function install_libraries()
305
315
popd
306
316
}
307
317
308
- function install_ide ()
318
+ function install_arduino_cli ()
309
319
{
310
- # TODO replace ide distribution + arduino-builder with arduino-cli
311
- local idever=' 1.8.19'
312
- local ideurl=" https://downloads.arduino.cc/arduino-$idever "
320
+ local path=$1
313
321
314
- echo " Arduino IDE ${idever} "
322
+ local ver=' 1.2.2'
323
+ local urlbase=" https://github.com/arduino/arduino-cli/releases/download/v${ver} /arduino-cli_${ver} _"
315
324
316
- local core_path=$1
317
- local ide_path=$2
325
+ echo " Arduino CLI ${ver} "
318
326
319
- mkdir -p ${core_path} /tools/dist
320
- pushd ${core_path} /tools/dist
327
+ mkdir -p ${cache_dir} /cli
328
+ pushd ${cache_dir} /cli
321
329
322
- if [ " ${RUNNER_OS-} " = " Windows" ]; then
323
- fetch_and_unpack " arduino-windows.zip" \
324
- " c4072d808aea3848bceff5772f9d1e56a0fde02366b5aa523d10975c54eee2ca8def25ee466abbc88995aa323d475065ad8eb30bf35a2aaf07f9473f9168e2da" \
325
- " ${ideurl} -windows.zip"
326
- mv arduino-$idever arduino-distrib
327
- elif [ " ${RUNNER_OS-} " = " macOS" ]; then
328
- fetch_and_unpack " arduino-macos.zip" \
329
- " 053b0c1e70da9176680264e40fcb9502f45ca5a879aeb8b6f71282b38bfdb87c63ebc6b88e35ea70a73720ad439d828cc8cb110e4c6ab07357126a36ee396325" \
330
- " ${ideurl} -macosx.zip"
331
- # Hack to place arduino-builder in the same spot as sane OSes
332
- mv Arduino.app arduino-distrib
333
- mv arduino-distrib/Contents/Java/* arduino-distrib/.
334
- else
335
- fetch_and_unpack " arduino-linux.tar.xz" \
336
- " 9328abf8778200019ed40d4fc0e6afb03a4cee8baaffbcea7dd3626477e14243f779eaa946c809fb153a542bf2ed60cf11a5f135c91ecccb1243c1387be95328" \
337
- " ${ideurl} -linux64.tar.xz"
338
- mv arduino-$idever arduino-distrib
339
- fi
330
+ case " ${RUNNER_OS-} " in
331
+ (" Linux" )
332
+ fetch_and_unpack " Linux_64bit.tar.gz" \
333
+ " d421e2b1cbef59c41e46cf06d077214a1d24cb784030462763781c9d3911cc55257fbcc02a7ee6a2ddda5b459101dc83aeda6b3b5198805bfdce856f82774c93" \
334
+ " ${urlbase} Linux_64bit.tar.gz"
335
+ ;;
336
+ (" Windows" )
337
+ fetch_and_unpack " Windows_64bit.zip" \
338
+ " 05b4eb5820fbaf670de00399d40513ecf2de9d0c2c5593a1227be03b2d11ba53e9d14cf6f934110447d6fd15c6a09769606a34fcab32ec3c2dbaa42f4627b072" \
339
+ " ${urlbase} Windows_64bit.zip"
340
+ ;;
341
+ (" macOS" )
342
+ fetch_and_unpack " macOS_ARM64.tar.gz" \
343
+ " 672693418b730d8ebc57cae2c892553e821706bee06312cc77a598e834afcba7d380df4d337138ecc03a4013a349d89b744b2a3b97fafc214b619856d9162827" \
344
+ " ${urlbase} macOS_ARM64.tar.gz"
345
+ ;;
346
+ (* )
347
+ echo ' Unknown ${RUNNER_OS} = "' ${RUNNER_OS} ' "'
348
+ exit 2
349
+ esac
350
+
351
+ cp -v arduino-cli $path
352
+ chmod +x $path
340
353
341
- mv arduino-distrib " $ide_path "
342
354
popd
343
355
}
344
356
@@ -388,8 +400,8 @@ function install_arduino()
388
400
echo ::group::Install arduino
389
401
local debug=$1
390
402
391
- test -d " $ESP8266_ARDUINO_IDE " \
392
- || install_ide " $ESP8266_ARDUINO_BUILD_DIR " " $ESP8266_ARDUINO_IDE "
403
+ command -v " ${ESP8266_ARDUINO_CLI} " \
404
+ || install_arduino_cli " ${ESP8266_ARDUINO_CLI} "
393
405
394
406
local hardware_core_path=" $ESP8266_ARDUINO_HARDWARE /esp8266com/esp8266"
395
407
test -d " $hardware_core_path " \
@@ -421,8 +433,7 @@ function build_sketches_with_arduino()
421
433
lwip=$( arduino_lwip_menu_option $3 )
422
434
423
435
build_sketches " $ESP8266_ARDUINO_BUILD_DIR " \
424
- " $ESP8266_ARDUINO_IDE " \
425
- " $ESP8266_ARDUINO_HARDWARE " \
436
+ " $ESP8266_ARDUINO_CLI " \
426
437
" $ESP8266_ARDUINO_LIBRARIES " \
427
438
" $build_mod " " $build_rem " " $lwip "
428
439
step_summary " Size report" " $cache_dir /size.log"
0 commit comments