mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-29 18:28:24 +02:00
Merge branch 'bugfix/failed_to_compile_on4.0' into 'master'
fix compilation issue on v-4.0 See merge request espressif/esp-mqtt!57
This commit is contained in:
@ -20,8 +20,10 @@ before_script:
|
||||
- curl -sSL ${CIT_LOADER_URL} | sh
|
||||
- source citools/import_functions
|
||||
- PATH=$CI_PROJECT_DIR/esp-idf/tools:$PATH
|
||||
- export IDF_PATH=$CI_PROJECT_DIR/esp-idf
|
||||
- export MQTT_PATH=$CI_PROJECT_DIR
|
||||
|
||||
build_with_older_idf:
|
||||
build_with_idf_v3:
|
||||
stage: build
|
||||
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
|
||||
tags:
|
||||
@ -29,16 +31,21 @@ build_with_older_idf:
|
||||
dependencies: []
|
||||
script:
|
||||
- cit_add_ssh_key "${GITLAB_KEY}"
|
||||
- git clone "${IDF_REPO}" && cd esp-idf && git checkout ${OLDER_IDF}
|
||||
- ./tools/ci/mirror-submodule-update.sh
|
||||
- export IDF_PATH=$(pwd)
|
||||
- cd $CI_PROJECT_DIR
|
||||
- ./modify_for_legacy_idf.sh ${RECENT_IDF} || true
|
||||
- cd $CI_PROJECT_DIR/examples/tcp
|
||||
- make defconfig
|
||||
- make
|
||||
- git clone "${IDF_REPO}"
|
||||
# build with IDFv3.2
|
||||
- $MQTT_PATH/ci/set_idf.sh release/v3.2
|
||||
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||
- $MQTT_PATH/ci/build_examples.sh make
|
||||
# build with IDFv3.3
|
||||
- $MQTT_PATH/ci/set_idf.sh release/v3.3
|
||||
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||
- $MQTT_PATH/ci/build_examples.sh make
|
||||
# simple build with IDFv3.1 (buiding directly in mqtt repo)
|
||||
- $MQTT_PATH/ci/set_idf.sh release/v3.1
|
||||
- cd $MQTT_PATH && ./ci/modify_for_legacy_idf.sh ${RECENT_IDF} || true
|
||||
- cd $MQTT_PATH/examples/tcp && rm -rf build && make defconfig && make
|
||||
|
||||
build_with_idf:
|
||||
build_with_idf_v4:
|
||||
stage: build
|
||||
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
|
||||
tags:
|
||||
@ -52,14 +59,9 @@ build_with_idf:
|
||||
script:
|
||||
- cit_add_ssh_key "${GITLAB_KEY}"
|
||||
- git clone "${IDF_REPO}"
|
||||
- cd esp-idf
|
||||
- tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
|
||||
- ./tools/ci/mirror-submodule-update.sh
|
||||
- export IDF_PATH=$(pwd)
|
||||
- cd $IDF_PATH/components/mqtt/esp-mqtt
|
||||
- rm -rf .git
|
||||
- cp -r $CI_PROJECT_DIR/.git .
|
||||
- git reset --hard $CI_COMMIT_SHA
|
||||
- $MQTT_PATH/ci/set_idf.sh master
|
||||
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
|
||||
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||
# capture compile commands/flags for static analysis
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/tcp
|
||||
- mkdir -p tidybuild && cd tidybuild
|
||||
@ -69,11 +71,17 @@ build_with_idf:
|
||||
- export PEDANTIC_CFLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
|
||||
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS} && export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
||||
# build other examples
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/tcp && idf.py build
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/ssl && idf.py build
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/ssl_mutual_auth && idf.py build
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/ws && idf.py build
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/wss && idf.py build
|
||||
- $MQTT_PATH/ci/build_examples.sh
|
||||
# rebuild with IDFv4.1
|
||||
- $MQTT_PATH/ci/set_idf.sh release/v4.1
|
||||
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
|
||||
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||
- $MQTT_PATH/ci/build_examples.sh
|
||||
# rebuild with IDFv4.0
|
||||
- $MQTT_PATH/ci/set_idf.sh release/v4.0
|
||||
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
|
||||
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||
- $MQTT_PATH/ci/build_examples.sh
|
||||
|
||||
build_and_test_qemu:
|
||||
stage: build
|
||||
@ -85,14 +93,9 @@ build_and_test_qemu:
|
||||
script:
|
||||
- cit_add_ssh_key "${GITLAB_KEY}"
|
||||
- git clone "${IDF_REPO}"
|
||||
- cd esp-idf
|
||||
- tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
|
||||
- ./tools/ci/mirror-submodule-update.sh
|
||||
- export IDF_PATH=$(pwd)
|
||||
- cd $IDF_PATH/components/mqtt/esp-mqtt
|
||||
- rm -rf .git
|
||||
- cp -r $CI_PROJECT_DIR/.git .
|
||||
- git reset --hard $CI_COMMIT_SHA
|
||||
- $MQTT_PATH/ci/set_idf.sh master
|
||||
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
|
||||
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||
# build publish stress test
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/publish_test && cat sdkconfig.qemu | $IDF_PATH/tools/ci/envsubst.py >> sdkconfig.defaults && idf.py build
|
||||
- source /opt/pyenv/activate && pyenv global 2.7.15 && python --version
|
||||
@ -109,7 +112,7 @@ clang_tidy_check:
|
||||
tags:
|
||||
- host_test
|
||||
dependencies:
|
||||
- build_with_idf
|
||||
- build_with_idf_v4
|
||||
artifacts:
|
||||
reports:
|
||||
junit: esp-idf/examples/protocols/mqtt/tcp/tidybuild/output.xml
|
||||
|
21
ci/build_examples.sh
Executable file
21
ci/build_examples.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# build mqtt examples with make if $1=="make", with cmake otherwise
|
||||
set -o errexit # Exit if command failed.
|
||||
|
||||
if [ -z $IDF_PATH ] ; then
|
||||
echo "Mandatory variables undefined"
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
examples="tcp ssl ssl_mutual_auth ws wss"
|
||||
for i in $examples; do
|
||||
echo "Building MQTT example $i"
|
||||
cd $IDF_PATH/examples/protocols/mqtt/$i
|
||||
if [[ "$1" = "make" ]]; then
|
||||
make defconfig
|
||||
make -j 4
|
||||
else
|
||||
idf.py build
|
||||
fi;
|
||||
done
|
19
ci/set_idf.sh
Executable file
19
ci/set_idf.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# sets up the IDF repo incl submodules with specified version as $1
|
||||
set -o errexit # Exit if command failed.
|
||||
|
||||
if [ -z $IDF_PATH ] || [ -z $MQTT_PATH ] || [ -z $1 ] ; then
|
||||
echo "Mandatory variables undefined"
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
echo "Checking out IDF version $1"
|
||||
cd $IDF_PATH
|
||||
# Cleans out the untracked files in the repo, so the next "git checkout" doesn't fail
|
||||
git clean -f
|
||||
git checkout $1
|
||||
# Removes the mqtt submodule, not the next submodule update doesn't fail
|
||||
rm -rf $IDF_PATH/components/mqtt/esp-mqtt
|
||||
./tools/ci/mirror-submodule-update.sh
|
||||
|
16
ci/set_mqtt.sh
Executable file
16
ci/set_mqtt.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# sets the mqtt in IDF tree as a submodule with the version specified as $1
|
||||
set -o errexit # Exit if command failed.
|
||||
|
||||
if [ -z $IDF_PATH ] || [ -z $MQTT_PATH ] || [ -z $1 ] ; then
|
||||
echo "Mandatory variables undefined"
|
||||
exit 1;
|
||||
fi;
|
||||
|
||||
echo "Checking out MQTT version to $1"
|
||||
# exchange remotes of mqtt submodules with plain copy
|
||||
cd $IDF_PATH/components/mqtt/esp-mqtt
|
||||
rm -rf .git # removes the actual IDF referenced version
|
||||
cp -r $MQTT_PATH/.git . # replaces with the MQTT_PATH (CI checked tree)
|
||||
git reset --hard $1 # sets the requested version
|
@ -223,17 +223,16 @@ static esp_err_t esp_mqtt_set_ssl_transport_properties(esp_transport_list_handle
|
||||
esp_transport_ssl_set_psk_key_hint(ssl, cfg->psk_hint_key);
|
||||
#else
|
||||
ESP_LOGE(TAG, "PSK authentication is not available in IDF version %s", IDF_VER);
|
||||
goto _mqtt_set_config_failed;
|
||||
goto esp_mqtt_set_transport_failed;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cfg->alpn_protos) {
|
||||
#if defined(MQTT_SUPPORTED_FEATURE_ALPN) && MQTT_ENABLE_SSL
|
||||
ESP_LOGE(TAG, "%p", cfg->alpn_protos);
|
||||
esp_transport_ssl_set_alpn_protocol(ssl, (const char **)cfg->alpn_protos);
|
||||
#else
|
||||
ESP_LOGE(TAG, "APLN is not available in IDF version %s", IDF_VER);
|
||||
goto _mqtt_set_config_failed;
|
||||
goto esp_mqtt_set_transport_failed;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user