build & config: Check requirements of managed components of main and add interface versioning

This commit is contained in:
Sergei Silnov
2022-05-13 19:21:30 +02:00
parent 07827ea362
commit 89518ee86a
4 changed files with 19 additions and 3 deletions

View File

@@ -460,10 +460,12 @@ macro(idf_build_process target)
# Call for the component manager to prepare remote dependencies
idf_build_get_property(python PYTHON)
idf_build_get_property(component_manager_interface_version __COMPONENT_MANAGER_INTERFACE_VERSION)
execute_process(COMMAND ${python}
"-m"
"idf_component_manager.prepare_components"
"--project_dir=${project_dir}"
"--interface_version=${component_manager_interface_version}"
"prepare_dependencies"
"--local_components_list_file=${local_components_list_file}"
"--managed_components_list_file=${managed_components_list_file}"

View File

@@ -227,10 +227,17 @@ function(__component_get_requirements)
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
if(idf_component_manager EQUAL 1)
idf_build_get_property(python PYTHON)
idf_build_get_property(component_manager_interface_version __COMPONENT_MANAGER_INTERFACE_VERSION)
# Call for the component manager once again to inject dependencies
# It modifies the requirements file generated by component_get_requirements.cmake script by adding dependencies
# defined in component manager manifests to REQUIRES and PRIV_REQUIRES fields.
# These requirements are also set as MANAGED_REQUIRES and MANAGED_PRIV_REQUIRES component properties.
execute_process(COMMAND ${python}
"-m"
"idf_component_manager.prepare_components"
"--project_dir=${project_dir}"
"--interface_version=${component_manager_interface_version}"
"inject_requirements"
"--idf_path=${idf_path}"
"--build_dir=${build_dir}"

View File

@@ -43,6 +43,8 @@ endif()
if(NOT "$ENV{IDF_COMPONENT_MANAGER}" EQUAL "0")
idf_build_set_property(IDF_COMPONENT_MANAGER 1)
endif()
# Set component manager interface version
idf_build_set_property(__COMPONENT_MANAGER_INTERFACE_VERSION 1)
#
# Get the project version from either a version file or the Git revision. This is passed
@@ -445,7 +447,10 @@ macro(project project_name)
__component_get_target(main_target idf::main)
__component_get_property(reqs ${main_target} REQUIRES)
__component_get_property(priv_reqs ${main_target} PRIV_REQUIRES)
if(NOT reqs AND NOT priv_reqs) #if user has not set any requirements
__component_get_property(managed_reqs ${main_target} MANAGED_REQUIRES)
__component_get_property(managed_priv_reqs ${main_target} MANAGED_PRIV_REQUIRES)
#if user has not set any requirements, except ones added with the component manager
if((NOT reqs OR reqs STREQUAL managed_reqs) AND (NOT priv_reqs OR priv_reqs STREQUAL managed_priv_reqs))
if(test_components)
list(REMOVE_ITEM build_components ${test_components})
endif()