-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/component_manager_load_all_local_components_v5.2' i…
…nto 'release/v5.2' fix: component manager load all component dirs even set(COMPONENTS ...) (v5.2) See merge request espressif/esp-idf!30433
- Loading branch information
Showing
3 changed files
with
46 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,46 @@ | ||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-FileCopyrightText: 2022-2024 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 | ||
from test_build_system_helpers import replace_in_file | ||
|
||
|
||
@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)', | ||
) | ||
) | ||
replace_in_file( | ||
test_app_copy / 'CMakeLists.txt', | ||
search='# placeholder_after_include_project_cmake', | ||
replace='idf_build_set_property(DEPENDENCIES_LOCK dependencies.lock.${IDF_TARGET})', | ||
) | ||
|
||
idf_py('add-dependency', 'example/cmp') | ||
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') | ||
|
||
|
||
def test_trimmed_components_still_passed_to_cmake(idf_py: IdfPyFunc, test_app_copy: Path) -> None: | ||
replace_in_file( | ||
test_app_copy / 'CMakeLists.txt', | ||
search='# placeholder_after_include_project_cmake', | ||
replace='set(COMPONENTS main)', | ||
) | ||
|
||
replace_in_file( | ||
test_app_copy / 'main' / 'CMakeLists.txt', | ||
search='# placeholder_inside_idf_component_register', | ||
replace='REQUIRES foo', | ||
) | ||
|
||
os.makedirs(test_app_copy / 'components') | ||
idf_py('create-component', '-C', 'components', 'foo') | ||
idf_py('add-dependency', '--component', 'foo', 'example/cmp') | ||
|
||
idf_py('reconfigure') | ||
|
||
with open('dependencies.lock', 'r') as f: | ||
fs = f.read() | ||
|
||
assert ' example/cmp:' in fs |