mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
fix(build): ensure the main component exists when MINIMAL_BUILD is enabled
The minimal build property is simply a shorthand for `set(COMPONENTS main)`. The issue is that there is currently no check to verify whether the `main` component actually exists or is known to the build system. If the `main` component is not present, print an error message along with suggestions on how to fix this inconsistency. Closes https://github.com/espressif/esp-idf/issues/18219 Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import json
|
||||
import logging
|
||||
@@ -579,3 +579,25 @@ def test_component_validation_with_common_platform_example(idf_py: IdfPyFunc, te
|
||||
assert re_source.search(ret.stderr) is None, (
|
||||
f'Unexpected source file ownership warning for common path: {ret.stderr}'
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.buildv2_skip('Build system v2 does not support MINIMAL_BUILD')
|
||||
def test_minimal_build_without_main_component(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
|
||||
logging.info('Verify that the build fails when using `MINIMAL_BUILD` without main component')
|
||||
|
||||
# Rename main to no_main
|
||||
shutil.move(test_app_copy / 'main', test_app_copy / 'no_main')
|
||||
|
||||
# Set minimal build property
|
||||
replace_in_file(
|
||||
(test_app_copy / 'CMakeLists.txt'),
|
||||
'# placeholder_after_include_project_cmake',
|
||||
'idf_build_set_property(MINIMAL_BUILD ON)',
|
||||
)
|
||||
|
||||
# Reconfigure should fail
|
||||
ret = idf_py('reconfigure', check=False)
|
||||
|
||||
assert 'MINIMAL_BUILD is enabled but component main was not found.' in ret.stderr, (
|
||||
'Reconfiguration should fail with missing main component and MINIMAL_BUILD ON'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user