mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/idfpy_update_component_manager_tests' into 'master'
CMake - process dependencies for all components by component manager Closes PACMAN-87 See merge request espressif/esp-idf!9357
This commit is contained in:
commit
e22de81955
@ -696,12 +696,12 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
|
||||
# Make sure that component manager is not installed
|
||||
pip uninstall -y idf_component_manager
|
||||
printf "\n#include \"test_component.h\"\n" >> main/main.c
|
||||
printf "dependencies:\n test_component:\n path: test_component\n git: ${COMPONENT_MANAGER_TEST_REPO}\n" >> idf_project.yml
|
||||
printf "dependencies:\n test_component:\n path: test_component\n git: ${COMPONENT_MANAGER_TEST_REPO}\n" >> main/idf_component.yml
|
||||
! idf.py build || failure "Build should fail if dependencies are not installed"
|
||||
pip install ${COMPONENT_MANAGER_REPO} || failure "Failed to install the component manager"
|
||||
pip install ${COMPONENT_MANAGER_PACKAGE} --upgrade || failure "Failed to install component manager"
|
||||
idf.py reconfigure build || failure "Build didn't succeed with required components installed by package manager"
|
||||
pip uninstall -y idf_component_manager
|
||||
rm idf_project.yml
|
||||
rm main/idf_component.yml
|
||||
git checkout main/main.c
|
||||
|
||||
print_status "Build fails if partitions don't fit in flash"
|
||||
|
@ -407,6 +407,70 @@ macro(idf_build_process target)
|
||||
idf_build_set_property(__COMPONENT_REQUIRES_COMMON "")
|
||||
endif()
|
||||
|
||||
# Call for component manager to download dependencies for all components
|
||||
idf_build_set_property(IDF_COMPONENT_MANAGER "$ENV{IDF_COMPONENT_MANAGER}")
|
||||
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
|
||||
if(idf_component_manager)
|
||||
if(idf_component_manager EQUAL "0")
|
||||
message(VERBOSE "IDF Component manager was explicitly disabled by setting IDF_COMPONENT_MANAGER=0")
|
||||
elseif(idf_component_manager EQUAL "1")
|
||||
set(managed_components_list_file ${build_dir}/managed_components_list.temp.cmake)
|
||||
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)
|
||||
set(__contents "${__contents} - name: \"${__component_name}\"\n path: \"${__component_dir}\"\n")
|
||||
endforeach()
|
||||
|
||||
file(WRITE ${local_components_list_file} "${__contents}")
|
||||
|
||||
# Call for the component manager to prepare remote dependencies
|
||||
execute_process(COMMAND ${PYTHON}
|
||||
"-m"
|
||||
"idf_component_manager.prepare_components"
|
||||
"--project_dir=${project_dir}"
|
||||
"prepare_dependencies"
|
||||
"--local_components_list_file=${local_components_list_file}"
|
||||
"--managed_components_list_file=${managed_components_list_file}"
|
||||
RESULT_VARIABLE result
|
||||
ERROR_VARIABLE error)
|
||||
|
||||
if(NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "${error}")
|
||||
endif()
|
||||
|
||||
include(${managed_components_list_file})
|
||||
|
||||
# Add managed components to list of all components
|
||||
# `managed_components` contains the list of components installed by the component manager
|
||||
# It is defined in the temporary managed_components_list_file file
|
||||
set(__COMPONENTS "${__COMPONENTS};${managed_components}")
|
||||
|
||||
file(REMOVE ${managed_components_list_file})
|
||||
file(REMOVE ${local_components_list_file})
|
||||
else()
|
||||
message(WARNING "IDF_COMPONENT_MANAGER environment variable is set to unknown value "
|
||||
"\"${idf_component_manager}\". If you want to use component manager set it to 1.")
|
||||
endif()
|
||||
else()
|
||||
idf_build_get_property(__component_targets __COMPONENT_TARGETS)
|
||||
set(__components_with_manifests "")
|
||||
foreach(__component_target ${__component_targets})
|
||||
__component_get_property(__component_dir ${__component_target} COMPONENT_DIR)
|
||||
if(EXISTS "${__component_dir}/idf_component.yml")
|
||||
set(__components_with_manifests "${__components_with_manifests}\t${__component_dir}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT "${__components_with_manifests}" STREQUAL "")
|
||||
message(WARNING "\"idf_component.yml\" file was found for components:\n${__components_with_manifests}"
|
||||
"However, the component manager is not enabled.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Perform early expansion of component CMakeLists.txt in CMake scripting mode.
|
||||
# It is here we retrieve the public and private requirements of each component.
|
||||
# It is also here we add the common component requirements to each component's
|
||||
|
@ -232,7 +232,7 @@ function(__component_get_requirements)
|
||||
"-m"
|
||||
"idf_component_manager.prepare_components"
|
||||
"--project_dir=${project_dir}"
|
||||
"inject_requrements"
|
||||
"inject_requirements"
|
||||
"--idf_path=${idf_path}"
|
||||
"--build_dir=${build_dir}"
|
||||
"--component_requires_file=${component_requires_file}"
|
||||
|
@ -169,7 +169,6 @@ function(__project_init components_var test_components_var)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
idf_build_set_property(IDF_COMPONENT_MANAGER "$ENV{IDF_COMPONENT_MANAGER}")
|
||||
|
||||
# Add component directories to the build, given the component filters, exclusions
|
||||
# extra directories, etc. passed from the root CMakeLists.txt.
|
||||
@ -181,43 +180,6 @@ function(__project_init components_var test_components_var)
|
||||
__project_component_dir(${component_dir})
|
||||
endforeach()
|
||||
else()
|
||||
# Add project manifest and lock file to the list of dependencies
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/idf_project.yml")
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/dependencies.lock")
|
||||
|
||||
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
|
||||
if(idf_component_manager)
|
||||
if(idf_component_manager EQUAL "0")
|
||||
message(VERBOSE "IDF Component manager was explicitly disabled by setting IDF_COMPONENT_MANAGER=0")
|
||||
elseif(idf_component_manager EQUAL "1")
|
||||
set(managed_components_list_file ${CMAKE_BINARY_DIR}/managed_components_list.temp.cmake)
|
||||
|
||||
# Call for package manager to prepare remote dependencies
|
||||
execute_process(COMMAND ${PYTHON}
|
||||
"-m"
|
||||
"idf_component_manager.prepare_components"
|
||||
"--project_dir=${CMAKE_CURRENT_LIST_DIR}"
|
||||
"prepare_dependencies"
|
||||
"--managed_components_list_file=${managed_components_list_file}"
|
||||
RESULT_VARIABLE result
|
||||
ERROR_VARIABLE error)
|
||||
|
||||
if(NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "${error}")
|
||||
endif()
|
||||
|
||||
# Include managed components
|
||||
include(${managed_components_list_file})
|
||||
file(REMOVE ${managed_components_list_file})
|
||||
else()
|
||||
message(WARNING "IDF_COMPONENT_MANAGER environment variable is set to unknown value "
|
||||
"\"${idf_component_manager}\". If you want to use component manager set it to 1.")
|
||||
endif()
|
||||
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/idf_project.yml")
|
||||
message(WARNING "\"idf_project.yml\" file is found in project directory, "
|
||||
"but component manager is not enabled. Please set IDF_COMPONENT_MANAGER environment variable.")
|
||||
endif()
|
||||
|
||||
spaces2list(EXTRA_COMPONENT_DIRS)
|
||||
foreach(component_dir ${EXTRA_COMPONENT_DIRS})
|
||||
__project_component_dir("${component_dir}")
|
||||
|
Loading…
Reference in New Issue
Block a user