mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat: Consume root-managed components from IDF Component Manager
This commit is contained in:
+14
-19
@@ -65,6 +65,17 @@ function(idf_build_unset_property property)
|
||||
idf_build_set_property(__BUILD_PROPERTIES "${build_properties}")
|
||||
endfunction()
|
||||
|
||||
function(__component_manager_get_command var)
|
||||
idf_build_get_property(python PYTHON)
|
||||
if(DEFINED ENV{IDF_COMPONENT_WRAPPER} AND NOT "$ENV{IDF_COMPONENT_WRAPPER}" STREQUAL "")
|
||||
set(component_manager_cmd
|
||||
"${python}" "$ENV{IDF_COMPONENT_WRAPPER}" "idf_component_manager.prepare_components")
|
||||
else()
|
||||
set(component_manager_cmd "${python}" "-m" "idf_component_manager.prepare_components")
|
||||
endif()
|
||||
set(${var} ${component_manager_cmd} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# idf_build_replace_option_from_property
|
||||
#
|
||||
# @brief Replace specified option with new one in a given property.
|
||||
@@ -359,6 +370,7 @@ function(idf_build_component component_dir)
|
||||
|
||||
# component_source must be one of the following (sorted by the override order):
|
||||
set(valid_component_sources "idf_components"
|
||||
"idf_managed_components"
|
||||
"project_managed_components"
|
||||
"project_extra_components"
|
||||
"project_components")
|
||||
@@ -678,7 +690,7 @@ macro(idf_build_process target)
|
||||
file(WRITE ${local_components_list_file} "${__contents}")
|
||||
|
||||
# Call for the component manager to prepare remote dependencies
|
||||
idf_build_get_property(python PYTHON)
|
||||
__component_manager_get_command(component_manager_cmd)
|
||||
idf_build_get_property(component_manager_interface_version __COMPONENT_MANAGER_INTERFACE_VERSION)
|
||||
idf_build_get_property(dependencies_lock_file DEPENDENCIES_LOCK)
|
||||
|
||||
@@ -687,9 +699,7 @@ macro(idf_build_process target)
|
||||
set(use_sdk_json FALSE)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${python}
|
||||
"-m"
|
||||
"idf_component_manager.prepare_components"
|
||||
execute_process(COMMAND ${component_manager_cmd}
|
||||
"--project_dir=${project_dir}"
|
||||
"--lock_path=${dependencies_lock_file}"
|
||||
"--interface_version=${component_manager_interface_version}"
|
||||
@@ -741,21 +751,6 @@ macro(idf_build_process target)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
idf_build_get_property(prefix __PREFIX)
|
||||
|
||||
file(GLOB root_dep_component_dirs
|
||||
${IDF_TOOLS_PATH}/root_managed_components/idf${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}/*)
|
||||
list(SORT root_dep_component_dirs)
|
||||
foreach(component_dir ${root_dep_component_dirs})
|
||||
# A potential component must be a directory
|
||||
if(IS_DIRECTORY ${component_dir})
|
||||
__component_dir_quick_check(is_component ${component_dir})
|
||||
if(is_component)
|
||||
__component_add(${component_dir} ${prefix} "idf_managed_components")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# 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
|
||||
|
||||
@@ -233,16 +233,14 @@ function(__component_get_requirements use_sdk_json)
|
||||
|
||||
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
|
||||
if(idf_component_manager EQUAL 1)
|
||||
idf_build_get_property(python PYTHON)
|
||||
__component_manager_get_command(component_manager_cmd)
|
||||
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"
|
||||
execute_process(COMMAND ${component_manager_cmd}
|
||||
"--project_dir=${project_dir}"
|
||||
"--lock_path=${DEPENDENCIES_LOCK}"
|
||||
"--interface_version=${component_manager_interface_version}"
|
||||
|
||||
@@ -156,7 +156,7 @@ 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 5)
|
||||
idf_build_set_property(__COMPONENT_MANAGER_INTERFACE_VERSION 6)
|
||||
|
||||
#
|
||||
# Parse and store the VERSION argument provided to the project() command.
|
||||
|
||||
@@ -122,9 +122,10 @@ set(CMAKE_BUILD_EARLY_EXPANSION 1)
|
||||
|
||||
# smaller number means lower priority
|
||||
set(__TARGETS_IDF_COMPONENTS "") # 0
|
||||
set(__TARGETS_PROJECT_MANAGED_COMPONENTS "") # 1
|
||||
set(__TARGETS_PROJECT_EXTRA_COMPONENTS "") # 2
|
||||
set(__TARGETS_PROJECT_COMPONENTS "") # 3
|
||||
set(__TARGETS_IDF_MANAGED_COMPONENTS "") # 1
|
||||
set(__TARGETS_PROJECT_MANAGED_COMPONENTS "") # 2
|
||||
set(__TARGETS_PROJECT_EXTRA_COMPONENTS "") # 3
|
||||
set(__TARGETS_PROJECT_COMPONENTS "") # 4
|
||||
|
||||
foreach(__component_target ${__component_targets})
|
||||
__component_get_property(__component_source ${__component_target} COMPONENT_SOURCE)
|
||||
|
||||
Reference in New Issue
Block a user