Skip to content

Commit 303bad3

Browse files
authored
Merge branch 'master' into feature/config_ui
2 parents 11c3298 + 4ec4d25 commit 303bad3

File tree

1 file changed

+51
-21
lines changed

1 file changed

+51
-21
lines changed

build.sh

+51-21
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function print_help() {
3030
echo " -d Deploy the build to github arduino-esp32"
3131
echo " -D Debug level to be set to ESP-IDF. One of default,none,error,warning,info,debug or verbose"
3232
echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'"
33-
echo " -t Set the build target(chip). ex. 'esp32s3'"
33+
echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32,esp32s3,esp32c3'"
3434
echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
3535
echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
3636
exit 1
@@ -64,7 +64,7 @@ while getopts ":A:I:i:c:t:b:D:sde" opt; do
6464
BUILD_DEBUG="$OPTARG"
6565
;;
6666
t )
67-
TARGET=$OPTARG
67+
IFS=',' read -ra TARGET <<< "$OPTARG"
6868
;;
6969
b )
7070
b=$OPTARG
@@ -91,6 +91,9 @@ done
9191
shift $((OPTIND -1))
9292
CONFIGS=$@
9393

94+
# Output the TARGET array
95+
echo "TARGET(s): ${TARGET[@]}"
96+
9497
mkdir -p dist
9598

9699
if [ $SKIP_ENV -eq 0 ]; then
@@ -121,27 +124,42 @@ if [ "$BUILD_TYPE" != "all" ]; then
121124
echo "ERROR: You need to specify target for non-default builds"
122125
print_help
123126
fi
124-
configs="configs/defconfig.common;configs/defconfig.$TARGET;configs/defconfig.debug_$BUILD_DEBUG"
125-
127+
126128
# Target Features Configs
127129
for target_json in `jq -c '.targets[]' configs/builds.json`; do
128130
target=$(echo "$target_json" | jq -c '.target' | tr -d '"')
129-
if [ "$TARGET" == "$target" ]; then
130-
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
131-
configs="$configs;configs/defconfig.$defconf"
132-
done
131+
132+
# Check if $target is in the $TARGET array
133+
target_in_array=false
134+
for item in "${TARGET[@]}"; do
135+
if [ "$item" = "$target" ]; then
136+
target_in_array=true
137+
break
138+
fi
139+
done
140+
141+
if [ "$target_in_array" = false ]; then
142+
# Skip building for targets that are not in the $TARGET array
143+
continue
133144
fi
134-
done
145+
146+
configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG"
147+
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
148+
configs="$configs;configs/defconfig.$defconf"
149+
done
135150

136-
# Configs From Arguments
137-
for conf in $CONFIGS; do
138-
configs="$configs;configs/defconfig.$conf"
139-
done
151+
echo "* Building for $target"
140152

141-
echo "idf.py -DIDF_TARGET=\"$TARGET\" -DSDKCONFIG_DEFAULTS=\"$configs\" $BUILD_TYPE"
142-
rm -rf build sdkconfig
143-
idf.py -DIDF_TARGET="$TARGET" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE
144-
if [ $? -ne 0 ]; then exit 1; fi
153+
# Configs From Arguments
154+
for conf in $CONFIGS; do
155+
configs="$configs;configs/defconfig.$conf"
156+
done
157+
158+
echo "idf.py -DIDF_TARGET=\"$target\" -DSDKCONFIG_DEFAULTS=\"$configs\" $BUILD_TYPE"
159+
rm -rf build sdkconfig
160+
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$configs" $BUILD_TYPE
161+
if [ $? -ne 0 ]; then exit 1; fi
162+
done
145163
exit 0
146164
fi
147165

@@ -153,11 +171,23 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
153171
target=$(echo "$target_json" | jq -c '.target' | tr -d '"')
154172
target_skip=$(echo "$target_json" | jq -c '.skip // 0')
155173

156-
if [ "$TARGET" != "all" ] && [ "$TARGET" != "$target" ]; then
157-
echo "* Skipping Target: $target"
158-
continue
159-
fi
174+
# Check if $target is in the $TARGET array if not "all"
175+
if [ "$TARGET" != "all" ]; then
176+
target_in_array=false
177+
for item in "${TARGET[@]}"; do
178+
if [ "$item" = "$target" ]; then
179+
target_in_array=true
180+
break
181+
fi
182+
done
160183

184+
# If $target is not in the $TARGET array, skip processing
185+
if [ "$target_in_array" = false ]; then
186+
echo "* Skipping Target: $target"
187+
continue
188+
fi
189+
fi
190+
161191
# Skip chips that should not be a part of the final libs
162192
# WARNING!!! this logic needs to be updated when cron builds are split into jobs
163193
if [ "$TARGET" = "all" ] && [ $target_skip -eq 1 ]; then

0 commit comments

Comments
 (0)