Merge branch 'bugfix/exclude_component_dirs_pacman_v4.4' into 'release/v4.4'

build: fix excluded components being passed to component manager (v4.4)

See merge request espressif/esp-idf!19623
This commit is contained in:
Ivan Grokhotkov 2022-09-16 22:10:05 +08:00
commit 25c968ec65
2 changed files with 18 additions and 13 deletions

View File

@ -843,28 +843,35 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
mv CMakeLists.bak CMakeLists.txt # revert previous modifications
rm -rf extra_dir components
print_status "Components in EXCLUDE_COMPONENTS not passed to idf_component_manager"
clean_build_dir
idf.py create-component -C components/ to_be_excluded || failure "Failed to create a component"
echo "invalid syntax..." > components/to_be_excluded/idf_component.yml
! idf.py reconfigure || failure "Build should have failed due to invalid syntax in idf_component.yml"
idf.py -DEXCLUDE_COMPONENTS=to_be_excluded reconfigure || failure "Build should have succeeded when the component is excluded"
rm -rf components/to_be_excluded
print_status "Create project using idf.py and build it"
echo "Trying to create project."
(idf.py -C projects create-project temp_test_project) || failure "Failed to create the project."
cd "$IDF_PATH/projects/temp_test_project"
pushd "$PWD/projects/temp_test_project"
echo "Building the project temp_test_project . . ."
idf.py build || failure "Failed to build the project."
cd "$IDF_PATH"
rm -rf "$IDF_PATH/projects/temp_test_project"
popd
rm -rf "$PWD/projects/temp_test_project"
print_status "Create component using idf.py, create project using idf.py."
print_status "Add the component to the created project and build the project."
echo "Trying to create project . . ."
(idf.py -C projects create-project temp_test_project) || failure "Failed to create the project."
pushd "$PWD/projects/temp_test_project"
echo "Trying to create component . . ."
(idf.py -C components create-component temp_test_component) || failure "Failed to create the component."
${SED} -i '5i\\tfunc();' "$IDF_PATH/projects/temp_test_project/main/temp_test_project.c"
${SED} -i '5i#include "temp_test_component.h"' "$IDF_PATH/projects/temp_test_project/main/temp_test_project.c"
cd "$IDF_PATH/projects/temp_test_project"
${SED} -i '5i\\tfunc();' "main/temp_test_project.c"
${SED} -i '5i#include "temp_test_component.h"' "main/temp_test_project.c"
idf.py build || failure "Failed to build the project."
cd "$IDF_PATH"
rm -rf "$IDF_PATH/projects/temp_test_project"
rm -rf "$IDF_PATH/components/temp_test_component"
popd
rm -rf "$PWD/projects/temp_test_project"
print_status "Check that command for creating new project will fail if the target folder is not empty."
mkdir "$IDF_PATH/example_proj/"

View File

@ -429,10 +429,8 @@ macro(idf_build_process target)
set(local_components_list_file ${build_dir}/local_components_list.temp.yml)
set(__contents "components:\n")
idf_build_get_property(__component_targets __COMPONENT_TARGETS)
foreach(__component_target ${__component_targets})
__component_get_property(__component_name ${__component_target} COMPONENT_NAME)
__component_get_property(__component_dir ${__component_target} COMPONENT_DIR)
foreach(__component_name ${components})
idf_component_get_property(__component_dir ${__component_name} COMPONENT_DIR)
set(__contents "${__contents} - name: \"${__component_name}\"\n path: \"${__component_dir}\"\n")
endforeach()