CMake(enhance): Complete defconfig include support with menuconfig writeback capability #17857
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request completes the defconfig
#includesupport for the CMake build system, enabling full round-trip editing viamenuconfig. This work builds upon the foundation laid in PR #16897, which added CMake support for preprocessing#includedirectives in defconfig files.Background
In PR #16897, we introduced CMake support for:
#includedirectives in defconfig files.configfile for KconfigHowever, this implementation had a critical limitation: users could only read from include-based defconfigs, not write back to them. When running
make menuconfig:.configwould be saved#includedirectivesSolution
This enhancement introduces a bidirectional defconfig processing pipeline that preserves the modular structure through menuconfig operations:
Phase 1: Preprocessing with Tree Structure Capture
process_config.pyto build a detailed hierarchical tree during#includeexpansion#includedirectives and their locationsconfig_tree.json)Phase 2: Original Configuration Snapshot
nuttx_kconfig.cmaketo save the original expanded defconfig asdefconfig.origPhase 3: Change Detection & Reconstruction
postprocess()function inprocess_config.pythat:#includestructurePhase 4: Integration with menuconfig
menuconfig.cmaketo call postprocessing after Kconfig savedefconfigImpact
Build System
#includedirectives are presentconfig_tree.json: Tree structure for postprocessingdefconfig.orig: Original expanded config for change detectionconfig_tree_dirty.json: For incremental builds with modifications${CMAKE_BINARY_DIR}and don't affect final outputUser Workflows
menuconfigwithout losing structureDeveloper Experience
config_tree.jsonprovides visibility into configuration hierarchyTesting
Basic Round-trip Testing
#includedirectivesmake menuconfigand make some changes#includedirectives are preserved in outputChange Type Testing
Include Level Testing
Migration Path
#includeat their own paceBenefits
menuconfignow preserves configuration organization