Merge branch 'bugfix/missing_component_check' into 'master'

fix(cmake): report correct error on unknown component name

See merge request espressif/esp-idf!32062
This commit is contained in:
Ivan Grokhotkov 2024-08-13 16:06:50 +08:00
commit 6db8c98e90
4 changed files with 18 additions and 4 deletions

View File

@ -295,11 +295,14 @@ function(__build_resolve_and_add_req var component_target req type)
__component_get_target(_req_target ${req})
__component_get_property(_component_name ${component_target} COMPONENT_NAME)
if(NOT _req_target)
message(FATAL_ERROR "Failed to resolve component '${req}' required by component '${_component_name}'.")
message(FATAL_ERROR
"Failed to resolve component '${req}' required by component '${_component_name}': unknown name.")
endif()
__component_get_property(_req_registered ${_req_target} __COMPONENT_REGISTERED)
if(NOT _req_registered)
message(FATAL_ERROR "Failed to resolve component '${req}' required by component '${_component_name}'.")
message(FATAL_ERROR
"Failed to resolve component '${req}' required by component '${_component_name}': "
"component not registered.")
endif()
__component_set_property(${component_target} ${type} ${_req_target} APPEND)
set(${var} ${_req_target} PARENT_SCOPE)

View File

@ -216,7 +216,7 @@
-
re: "Failed to resolve component '(?!esp_ipc)(\\w+)'"
hint: "The component {} could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager, the component has been removed and refactored into some other component or the component may not be supported by the selected target.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build."
hint: "The component '{}' could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager, the component has been removed and refactored into some other component or the component may not be supported by the selected target.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build."
match_to_output: True
-

View File

@ -153,3 +153,14 @@ def test_version_in_component_cmakelist(idf_py: IdfPyFunc, test_app_copy: Path)
replace_in_file((test_app_copy / 'main' / 'CMakeLists.txt'), '# placeholder_before_idf_component_register',
'\n'.join(['if (NOT IDF_VERSION_MAJOR)', ' message(FATAL_ERROR "IDF version not set")', 'endif()']))
idf_py('reconfigure')
def test_unknown_component_error(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
logging.info('When unknown component name is specified, correct error is shown')
replace_in_file(
test_app_copy / 'main' / 'CMakeLists.txt',
search='# placeholder_inside_idf_component_register',
replace='REQUIRES unknown',
)
ret = idf_py('reconfigure', check=False)
assert 'Failed to resolve component \'unknown\' required by component \'main\'' in ret.stderr

View File

@ -47,7 +47,7 @@
"HINT: The struct 'esp_tls_t' has now been made private - its elements can be only be accessed/modified through respective getter/setter functions. Please refer to the migration guide for more information."
"Failed to resolve component 'component'\n":
"HINT: The component component could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager, the component has been removed and refactored into some other component or the component may not be supported by the selected target.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build."
"HINT: The component 'component' could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager, the component has been removed and refactored into some other component or the component may not be supported by the selected target.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build."
'fatal error: tmp/atca_mbedtls_wrap.h: No such file or directory\n':
"HINT: To use CONFIG_ESP_TLS_USE_SECURE_ELEMENT option, please install `esp-cryptoauthlib` using 'idf.py add-dependency espressif/esp-cryptoauthlib'"