mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 12:10:59 +00:00
feat(hints): use all_component_info from project_description.json
Currently the component_requirements hint module does not work as expected if the component list for a project is trimmed down. With the new "all_component_info" dictionary info in project_description.json, the module can produce hints even if cmake's COMPONENTS variable is set. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -171,5 +171,34 @@ class TestNestedModuleComponentRequirements(unittest.TestCase):
|
||||
self.tmpdir.cleanup()
|
||||
|
||||
|
||||
class TestTrimmedModuleComponentRequirements(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
# Set up a dummy project with a trimmed down list of components and main component.
|
||||
# The main component includes "esp_http_client.h", but the esp_http_client
|
||||
# component is not added to main's requirements.
|
||||
self.tmpdir = tempfile.TemporaryDirectory()
|
||||
self.tmpdirpath = Path(self.tmpdir.name)
|
||||
|
||||
self.projectdir = self.tmpdirpath / 'project'
|
||||
self.projectdir.mkdir(parents=True)
|
||||
(self.projectdir / 'CMakeLists.txt').write_text((
|
||||
'cmake_minimum_required(VERSION 3.16)\n'
|
||||
'set(COMPONENTS main)\n'
|
||||
'include($ENV{IDF_PATH}/tools/cmake/project.cmake)\n'
|
||||
'project(foo)'))
|
||||
|
||||
maindir = self.projectdir / 'main'
|
||||
maindir.mkdir()
|
||||
(maindir / 'CMakeLists.txt').write_text('idf_component_register(SRCS "foo.c")')
|
||||
(maindir / 'foo.c').write_text('#include "esp_http_client.h"\nvoid app_main(){}')
|
||||
|
||||
def test_trimmed_component_requirements(self) -> None:
|
||||
output = run_idf(['app'], self.projectdir)
|
||||
self.assertIn('To fix this, add esp_http_client to PRIV_REQUIRES list of idf_component_register call in', output)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.tmpdir.cleanup()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user