|
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,14 +89,21 @@ 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" |
| 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}" |
94 | 107 |
|
95 | 108 | # Select the common part of the FQBN based on the target. The rest will be
|
96 | 109 | # appended depending on the passed options.
|
@@ -154,7 +167,8 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
|
154 | 167 | requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
|
155 | 168 | if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
|
156 | 169 | for requirement in $requirements; do
|
157 |
| - found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig) |
| 170 | + requirement=$(echo $requirement | xargs) |
| 171 | + found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig") |
158 | 172 | if [[ "$found_line" == "" ]]; then
|
159 | 173 | echo "Target $target does not meet the requirement $requirement for $sketchname. Skipping."
|
160 | 174 | exit 0
|
@@ -270,10 +284,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
|
270 | 284 | unset options
|
271 | 285 | }
|
272 | 286 |
|
273 |
| -function count_sketches(){ # count_sketches <path> [target] [file] |
| 287 | +function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requirements] |
274 | 288 | local path=$1
|
275 | 289 | local target=$2
|
276 | 290 | local file=$3
|
| 291 | + local ignore_requirements=$4 |
277 | 292 |
|
278 | 293 | if [ $# -lt 1 ]; then
|
279 | 294 | echo "ERROR: Illegal number of parameters"
|
@@ -306,15 +321,18 @@ function count_sketches(){ # count_sketches <path> [target] [file]
|
306 | 321 | continue
|
307 | 322 | fi
|
308 | 323 |
|
309 |
| - # Check if the sketch requires any configuration options |
310 |
| - requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json) |
311 |
| - if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then |
312 |
| - for requirement in $requirements; do |
313 |
| - found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig) |
314 |
| - if [[ "$found_line" == "" ]]; then |
315 |
| - continue 2 |
316 |
| - fi |
317 |
| - done |
| 324 | + if [[ "$ignore_requirements" != "1" ]]; then |
| 325 | + # Check if the sketch requires any configuration options |
| 326 | + requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json) |
| 327 | + if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then |
| 328 | + for requirement in $requirements; do |
| 329 | + requirement=$(echo $requirement | xargs) |
| 330 | + found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig) |
| 331 | + if [[ "$found_line" == "" ]]; then |
| 332 | + continue 2 |
| 333 | + fi |
| 334 | + done |
| 335 | + fi |
318 | 336 | fi
|
319 | 337 | fi
|
320 | 338 | echo $sketch >> sketches.txt
|
|
0 commit comments