From 432306bb389394679da9e0c2bb74e0ae3012fb9f Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Wed, 13 Aug 2025 19:48:14 +0200 Subject: [PATCH] feat(tools): generate kconfig.in files for components not included in the build To generate a complete configuration for all discovered components, we need to ensure that even kconfig files for the excluded components are seen by Kconfig. Modify the prepare_kconfig_files.py script to generate files that list the Kconfig files for excluded components. These files are sourced in the root Kconfig using the COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE and COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE environment variables. Signed-off-by: Frantisek Hrbata --- tools/kconfig_new/prepare_kconfig_files.py | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tools/kconfig_new/prepare_kconfig_files.py b/tools/kconfig_new/prepare_kconfig_files.py index 8715cd05c3a..07d9e7682d0 100644 --- a/tools/kconfig_new/prepare_kconfig_files.py +++ b/tools/kconfig_new/prepare_kconfig_files.py @@ -19,14 +19,14 @@ def _prepare_source_files(env_dict: dict[str, str], list_separator: str) -> None - COMPONENT_KCONFIGS_SOURCE_FILE, - COMPONENT_KCONFIGS_PROJBUILD, - COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE, - - COMPONENT_KCONFIGS_EXCLUDED, (TODO: Currently disabled) - - COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED. (TODO: Currently disabled) + - COMPONENT_KCONFIGS_EXCLUDED, + - COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED, The outputs are written into files pointed by the value of - COMPONENT_KCONFIGS_SOURCE_FILE, - COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE, - - COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE, (TODO: Currently disabled) - - COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE, (TODO: Currently disabled) + - COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE, + - COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE, After running this function, all source files will contain a list of source statements based on the content of their corresponding environment variables. For example, if COMPONENT_KCONFIGS="var1;var2;var3" and @@ -68,16 +68,15 @@ def _prepare_source_files(env_dict: dict[str, str], list_separator: str) -> None _write_source_file( env_dict['COMPONENT_KCONFIGS_PROJBUILD'], env_dict['COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE'] ) - # TODO: Enable excluded Kconfig processing once integration is complete - # Currently commented out due to FileNotFoundError when paths are empty during CI tests - # _write_source_file( - # env_dict['COMPONENT_KCONFIGS_EXCLUDED'], - # env_dict['COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE'] - # ) - # _write_source_file( - # env_dict['COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED'], - # env_dict['COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE'], - # ) + if env_dict.get('COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE'): + _write_source_file( + env_dict['COMPONENT_KCONFIGS_EXCLUDED'], env_dict['COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE'] + ) + if env_dict.get('COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE'): + _write_source_file( + env_dict['COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED'], + env_dict['COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE'], + ) except KeyError as e: print('Error:', e, 'is not defined!') sys.exit(1)