kopia lustrzana https://github.com/espressif/esp-idf
Move call for component manager to build.cmake
rodzic
99bf2ed61d
commit
a5981c12c2
|
@ -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,39 +180,6 @@ function(__project_init components_var test_components_var)
|
|||
__project_component_dir(${component_dir})
|
||||
endforeach()
|
||||
else()
|
||||
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}/main/idf_component.yml")
|
||||
message(WARNING "\"idf_component.yml\" file is found in project's main component 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}")
|
||||
|
|
Ładowanie…
Reference in New Issue