@@ -20,17 +20,18 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1
2020
2121CCACHE_ENABLE=1
2222
23- TARGET=" all"
23+ export TARGET=" all"
2424BUILD_TYPE=" all"
2525BUILD_DEBUG=" default"
2626SKIP_ENV=0
2727COPY_OUT=0
28- ARCHIVE_OUT=0
28+ ARCHIVE_OUT=1
2929if [ -z $DEPLOY_OUT ]; then
3030 DEPLOY_OUT=0
3131fi
3232
3333function print_help() {
34+
3435 echo " Usage: build.sh [-s] [-n] [-A <arduino_branch>] [-I <idf_branch>] [-D <debug_level>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
3536 echo " -s Skip installing/updating of ESP-IDF and all components"
3637 echo " -n Disable ccache"
@@ -47,17 +48,17 @@ function print_help() {
4748 exit 1
4849}
4950
50- while getopts " :A:I:i:c:t:b:D:sde " opt; do
51+ while getopts " :A:I:i:c:t:b:D:sdne " opt; do
5152 case ${opt} in
5253 s )
5354 SKIP_ENV=1
5455 ;;
55- n )
56- CCACHE_ENABLE=0
57- ;;
5856 d )
5957 DEPLOY_OUT=1
6058 ;;
59+ n )
60+ CCACHE_ENABLE=0
61+ ;;
6162 e )
6263 ARCHIVE_OUT=1
6364 ;;
@@ -112,6 +113,8 @@ echo "TARGET(s): ${TARGET[@]}"
112113
113114mkdir -p dist
114115
116+ rm -rf dependencies.lock
117+
115118if [ $SKIP_ENV -eq 0 ]; then
116119 echo " * Installing/Updating ESP-IDF and all components..."
117120 # update components from git
@@ -131,6 +134,10 @@ else
131134 source ./tools/config.sh
132135fi
133136
137+ if [ -f " $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash" ]; then
138+ rm -rf $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash
139+ fi
140+
134141if [ " $BUILD_TYPE " != " all" ]; then
135142 if [ " $TARGET " = " all" ]; then
136143 echo " ERROR: You need to specify target for non-default builds"
@@ -175,9 +182,20 @@ if [ "$BUILD_TYPE" != "all" ]; then
175182 exit 0
176183fi
177184
185+ git submodule update --init --recursive
186+
178187rm -rf build sdkconfig out
179188mkdir -p " $AR_TOOLS /esp32-arduino-libs"
180189
190+ # Add release-info
191+ rm -rf release-info.txt
192+ IDF_Commit_short=$( git -C " $IDF_PATH " rev-parse --short HEAD || echo " " )
193+ AR_Commit_short=$( git -C " $AR_COMPS /arduino" rev-parse --short HEAD || echo " " )
194+ echo " Framework built from
195+ - $IDF_REPO branch [$IDF_BRANCH ](https://github.com/$IDF_REPO /tree/$IDF_BRANCH ) commit [$IDF_Commit_short ](https://github.com/$IDF_REPO /commits/$IDF_BRANCH /#:~:text=$IDF_Commit_short )
196+ - $AR_REPO branch [$AR_BRANCH ](https://github.com/$AR_REPO /tree/$AR_BRANCH ) commit [$AR_Commit_short ](https://github.com/$AR_REPO /commits/$AR_BRANCH /#:~:text=$AR_Commit_short )
197+ - Arduino lib builder branch: $GIT_BRANCH " >> release-info.txt
198+
181199# targets_count=`jq -c '.targets[] | length' configs/builds.json`
182200for target_json in ` jq -c ' .targets[]' configs/builds.json` ; do
183201 target=$( echo " $target_json " | jq -c ' .target' | tr -d ' "' )
@@ -221,6 +239,9 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
221239 idf_libs_configs=" $idf_libs_configs ;configs/defconfig.$defconf "
222240 done
223241
242+ if [ -f " $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash" ]; then
243+ rm -rf $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash
244+ fi
224245 echo " * Build IDF-Libs: $idf_libs_configs "
225246 rm -rf build sdkconfig
226247 idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $idf_libs_configs " idf-libs
@@ -246,6 +267,10 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
246267 bootloader_configs=" $bootloader_configs ;configs/defconfig.$defconf " ;
247268 done
248269
270+ if [ -f " $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash" ]; then
271+ rm -rf $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash
272+ fi
273+
249274 echo " * Build BootLoader: $bootloader_configs "
250275 rm -rf build sdkconfig
251276 idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $bootloader_configs " copy-bootloader
@@ -259,6 +284,10 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
259284 mem_configs=" $mem_configs ;configs/defconfig.$defconf " ;
260285 done
261286
287+ if [ -f " $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash" ]; then
288+ rm -rf $AR_MANAGED_COMPS /espressif__esp-sr/.component_hash
289+ fi
290+
262291 echo " * Build Memory Variant: $mem_configs "
263292 rm -rf build sdkconfig
264293 idf.py -DIDF_TARGET=" $target " -DSDKCONFIG_DEFAULTS=" $mem_configs " mem-variant
@@ -304,6 +333,7 @@ if [ "$BUILD_TYPE" = "all" ]; then
304333 python3 ./tools/gen_tools_json.py -i " $IDF_PATH " -o " $TOOLS_JSON_OUT /"
305334 if [ $? -ne 0 ]; then exit 1; fi
306335fi
336+ export IDF_COMMIT=$( git -C " $IDF_PATH " rev-parse --short HEAD)
307337
308338# Generate pioarduino manifest file
309339if [ " $BUILD_TYPE " = " all" ]; then
@@ -316,12 +346,29 @@ if [ "$BUILD_TYPE" = "all" ]; then
316346 if [ $? -ne 0 ]; then exit 1; fi
317347fi
318348
349+ AR_VERSION=$( jq -c ' .version' " $AR_COMPS /arduino/package.json" | tr -d ' "' )
350+ AR_VERSION_UNDERSCORE=` echo " $AR_VERSION " | tr . _`
351+
352+ # Generate PlatformIO framework manifest file
353+ rm -rf " $AR_ROOT /package.json"
354+
319355# copy everything to arduino-esp32 installation
320356if [ $COPY_OUT -eq 1 ] && [ -d " $ESP32_ARDUINO " ]; then
321357 echo " * Copying to Arduino..."
322358 ./tools/copy-to-arduino.sh
323359 if [ $? -ne 0 ]; then exit 1; fi
324360fi
361+ AR_VERSION=$( jq -c ' .version' " $AR_COMPS /arduino/package.json" | tr -d ' "' )
362+ AR_VERSION_UNDERSCORE=` echo " $AR_VERSION " | tr . _`
363+
364+
365+
366+ # Generate core_version.h
367+ rm -rf " $AR_ROOT /core_version.h"
368+ echo " #define ARDUINO_ESP32_GIT_VER 0x$AR_Commit_short
369+ #define ARDUINO_ESP32_GIT_DESC $AR_VERSION
370+ #define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE
371+ #define ARDUINO_ESP32_RELEASE \" $AR_VERSION_UNDERSCORE \" " >> " $AR_ROOT /core_version.h"
325372
326373# push changes to esp32-arduino-libs and create pull request into arduino-esp32
327374if [ $DEPLOY_OUT -eq 1 ]; then
0 commit comments