Merge branch 'feature/component_manager_custom_lock_file' into 'master'

component manager: add variable `DEPENDENCIES_LOCK`

Closes PACMAN-407 and IDFGH-7867

See merge request espressif/esp-idf!19878
This commit is contained in:
Fu Hanxi
2022-12-14 22:03:48 +08:00
7 changed files with 34 additions and 1 deletions

View File

@@ -1177,6 +1177,7 @@ These are properties that describe the build. Values of build properties can be
- COMPILE_OPTIONS - compile options applied to all components' source files, regardless of it being C or C++ - COMPILE_OPTIONS - compile options applied to all components' source files, regardless of it being C or C++
- COMPILE_DEFINITIONS - compile definitions applied to all component source files - COMPILE_DEFINITIONS - compile definitions applied to all component source files
- CXX_COMPILE_OPTIONS - compile options applied to all components' C++ source files - CXX_COMPILE_OPTIONS - compile options applied to all components' C++ source files
- DEPENDENCIES_LOCK - lock file path used in component manager. The default value is `dependencies.lock` under the project path.
- EXECUTABLE - project executable; set by call to ``idf_build_executable`` - EXECUTABLE - project executable; set by call to ``idf_build_executable``
- EXECUTABLE_NAME - name of project executable without extension; set by call to ``idf_build_executable`` - EXECUTABLE_NAME - name of project executable without extension; set by call to ``idf_build_executable``
- EXECUTABLE_DIR - path containing the output executable - EXECUTABLE_DIR - path containing the output executable

View File

@@ -23,6 +23,8 @@ When CMake configures the project (e.g. ``idf.py reconfigure``) component manage
The lock-file ``dependencies.lock`` and content of ``managed_components`` directory is not supposed to be modified by a user. When the component manager runs it always make sure they are up to date. If these files were accidentally modified it's possible to re-run the component manager by triggering CMake with ``idf.py reconfigure`` The lock-file ``dependencies.lock`` and content of ``managed_components`` directory is not supposed to be modified by a user. When the component manager runs it always make sure they are up to date. If these files were accidentally modified it's possible to re-run the component manager by triggering CMake with ``idf.py reconfigure``
You may set build property ``DEPENDENCIES_LOCK`` to specify the lock-file path in the top-level CMakeLists.txt. For example, adding ``idf_build_set_property(DEPENDENCIES_LOCK dependencies.lock.${IDF_TARGET})`` before ``project(PROJECT_NAME)`` could help generate different lock files for different targets.
Defining dependencies in the manifest Defining dependencies in the manifest
===================================== =====================================

View File

@@ -6,6 +6,7 @@
# #
# Warnings in this file must be in the same overall order as the log file. # Warnings in this file must be in the same overall order as the log file.
# #
idf-component-manager.rst: WARNING: Badly formated string substitution: {IDF_TARGET}
esp_ble_mesh_defs.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/bluetooth/esp-ble-mesh:line. esp_ble_mesh_defs.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/bluetooth/esp-ble-mesh:line.
Declaration is '.. cpp:member:: uint16_t model_id'. Declaration is '.. cpp:member:: uint16_t model_id'.
rmt_encoder.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/peripherals/rmt:line. rmt_encoder.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/peripherals/rmt:line.

View File

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

View File

@@ -237,6 +237,7 @@ function(__component_get_requirements)
"-m" "-m"
"idf_component_manager.prepare_components" "idf_component_manager.prepare_components"
"--project_dir=${project_dir}" "--project_dir=${project_dir}"
"--lock_path=${DEPENDENCIES_LOCK}"
"--interface_version=${component_manager_interface_version}" "--interface_version=${component_manager_interface_version}"
"inject_requirements" "inject_requirements"
"--idf_path=${idf_path}" "--idf_path=${idf_path}"

View File

@@ -44,7 +44,7 @@ if(NOT "$ENV{IDF_COMPONENT_MANAGER}" EQUAL "0")
idf_build_set_property(IDF_COMPONENT_MANAGER 1) idf_build_set_property(IDF_COMPONENT_MANAGER 1)
endif() endif()
# Set component manager interface version # Set component manager interface version
idf_build_set_property(__COMPONENT_MANAGER_INTERFACE_VERSION 1) idf_build_set_property(__COMPONENT_MANAGER_INTERFACE_VERSION 2)
# #
# Get the project version from either a version file or the Git revision. This is passed # Get the project version from either a version file or the Git revision. This is passed

View File

@@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import os.path
from pathlib import Path
import pytest
from test_build_system_helpers import IdfPyFunc
@pytest.mark.test_app_copy('examples/get-started/blink')
def test_dependency_lock(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
with open(test_app_copy / 'CMakeLists.txt', 'r+') as fw:
data = fw.read()
fw.seek(0)
fw.write(
data.replace(
'project(blink)',
'idf_build_set_property(DEPENDENCIES_LOCK dependencies.lock.${IDF_TARGET})\nproject(blink)',
)
)
idf_py('fullclean')
idf_py('reconfigure')
assert os.path.isfile(test_app_copy / 'dependencies.lock.esp32')
assert not os.path.isfile(test_app_copy / 'dependencies.lock')