forked from espressif/esp-idf
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:
@@ -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_DEFINITIONS - compile definitions applied to all component 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_NAME - name of project executable without extension; set by call to ``idf_build_executable``
|
||||
- EXECUTABLE_DIR - path containing the output executable
|
||||
|
@@ -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``
|
||||
|
||||
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
|
||||
=====================================
|
||||
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#
|
||||
# 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.
|
||||
Declaration is '.. cpp:member:: uint16_t model_id'.
|
||||
rmt_encoder.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/peripherals/rmt:line.
|
||||
|
@@ -524,10 +524,13 @@ 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)
|
||||
idf_build_get_property(dependencies_lock_file DEPENDENCIES_LOCK)
|
||||
|
||||
execute_process(COMMAND ${python}
|
||||
"-m"
|
||||
"idf_component_manager.prepare_components"
|
||||
"--project_dir=${project_dir}"
|
||||
"--lock_path=${dependencies_lock_file}"
|
||||
"--interface_version=${component_manager_interface_version}"
|
||||
"prepare_dependencies"
|
||||
"--local_components_list_file=${local_components_list_file}"
|
||||
|
@@ -237,6 +237,7 @@ function(__component_get_requirements)
|
||||
"-m"
|
||||
"idf_component_manager.prepare_components"
|
||||
"--project_dir=${project_dir}"
|
||||
"--lock_path=${DEPENDENCIES_LOCK}"
|
||||
"--interface_version=${component_manager_interface_version}"
|
||||
"inject_requirements"
|
||||
"--idf_path=${idf_path}"
|
||||
|
@@ -44,7 +44,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 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
|
||||
|
25
tools/test_build_system/test_component_manager.py
Normal file
25
tools/test_build_system/test_component_manager.py
Normal 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')
|
Reference in New Issue
Block a user