From 73bbe343ec9a280b3c867989ddc14a10a1892522 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 18 Aug 2026 10:28:37 +0200 Subject: [PATCH 1/7] fix(test_apps): drop obsolete esp_common dependency violations --- tools/test_apps/system/g1_components/check_dependencies.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/test_apps/system/g1_components/check_dependencies.py b/tools/test_apps/system/g1_components/check_dependencies.py index 7f50d9a80aa..768624c1c3b 100644 --- a/tools/test_apps/system/g1_components/check_dependencies.py +++ b/tools/test_apps/system/g1_components/check_dependencies.py @@ -64,7 +64,6 @@ expected_dep_violations = { # dependency graph captures edges that target_link_libraries creates at link # time but were never recorded as requires. if os.environ.get('IDF_BUILD_V2'): - expected_dep_violations.setdefault('esp_common', []).extend(['efuse', 'bootloader_support', 'app_update']) expected_dep_violations['esp_system'].append('esp_app_format') # Target-specific expected dependency violations From 78d3f61757e8634c5a6b8f281347ae7d6e3146fe Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 18 Aug 2026 10:28:50 +0200 Subject: [PATCH 2/7] change(test_apps): decouple g0_components from BUILD_COMPONENTS property The BUILD_COMPONENTS build property only exists when building through the Build system v1 compatibility shim. Query the executable library interface's linked-components list instead, so the app does not depend on compatibility-only properties. --- tools/test_apps/system/g0_components/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/test_apps/system/g0_components/CMakeLists.txt b/tools/test_apps/system/g0_components/CMakeLists.txt index 8b22859e738..8e03f18b357 100644 --- a/tools/test_apps/system/g0_components/CMakeLists.txt +++ b/tools/test_apps/system/g0_components/CMakeLists.txt @@ -70,7 +70,12 @@ set(expected_components set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib") # Get all the components that were required to initialize this project -idf_build_get_property(build_components BUILD_COMPONENTS) +if(IDF_BUILD_V2) + get_target_property(library ${project_elf} LIBRARY_INTERFACE) + idf_library_get_property(build_components "${library}" LIBRARY_COMPONENTS_LINKED) +else() + idf_build_get_property(build_components BUILD_COMPONENTS) +endif() # Sort lists to be able to compare them literally list(SORT expected_components) From d519de14d1727558bdb39b25dcc1cc6d9636f8e0 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 18 Aug 2026 10:29:04 +0200 Subject: [PATCH 3/7] change(test_apps): decouple g1_components from BUILD_COMPONENTS property The BUILD_COMPONENTS build property only exists when building through the Build system v1 compatibility shim. Query the executable library interface's linked-components list instead, so the app does not depend on compatibility-only properties. --- tools/test_apps/system/g1_components/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/test_apps/system/g1_components/CMakeLists.txt b/tools/test_apps/system/g1_components/CMakeLists.txt index 3d7dfeab25b..26d1ebd22e0 100644 --- a/tools/test_apps/system/g1_components/CMakeLists.txt +++ b/tools/test_apps/system/g1_components/CMakeLists.txt @@ -126,7 +126,12 @@ set(expected_components list(SORT expected_components) -idf_build_get_property(build_components BUILD_COMPONENTS) +if(IDF_BUILD_V2) + get_target_property(library ${project_elf} LIBRARY_INTERFACE) + idf_library_get_property(build_components "${library}" LIBRARY_COMPONENTS_LINKED) +else() + idf_build_get_property(build_components BUILD_COMPONENTS) +endif() list(SORT build_components) if(NOT "${expected_components}" STREQUAL "${build_components}") From 052f444f323ce5cacda0503bf518455d1bffb4f9 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 18 Aug 2026 10:29:31 +0200 Subject: [PATCH 4/7] change(test_apps): decouple netif_components from BUILD_COMPONENTS property The BUILD_COMPONENTS build property only exists when building through the Build system v1 compatibility shim. Query the executable library interface's linked-components list instead, so the app does not depend on compatibility-only properties. --- tools/test_apps/protocols/netif_components/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/test_apps/protocols/netif_components/CMakeLists.txt b/tools/test_apps/protocols/netif_components/CMakeLists.txt index e5eee571d9c..cf2be268054 100644 --- a/tools/test_apps/protocols/netif_components/CMakeLists.txt +++ b/tools/test_apps/protocols/netif_components/CMakeLists.txt @@ -56,7 +56,12 @@ idf_build_set_property(__BUILD_COMPONENT_DEPGRAPH_ENABLED 1) project(network_components) # Get the actual build components included in the build -idf_build_get_property(build_components BUILD_COMPONENTS) +if(IDF_BUILD_V2) + get_target_property(library ${project_elf} LIBRARY_INTERFACE) + idf_library_get_property(build_components "${library}" LIBRARY_COMPONENTS_LINKED) +else() + idf_build_get_property(build_components BUILD_COMPONENTS) +endif() message(STATUS "Build components needed my main and ${component_under_test}:") foreach(comp ${build_components}) From b91f894234590febcdaf0e3ff019bc61ae4aaf2a Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 18 Aug 2026 10:50:49 +0200 Subject: [PATCH 5/7] change(build): reject BUILD_COMPONENTS in all cmakev2 builds The compatibility shim populated BUILD_COMPONENTS from the library interface's linked-components list so that consumers reading it kept working. Those consumers now query the library interface directly, so drop the shim population and reject reads of the property unconditionally. --- tools/cmakev2/build.cmake | 7 +------ tools/cmakev2/project.cmake | 21 ++----------------- .../buildv2/test_migration.py | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/tools/cmakev2/build.cmake b/tools/cmakev2/build.cmake index 1017154a771..102a94af1c2 100644 --- a/tools/cmakev2/build.cmake +++ b/tools/cmakev2/build.cmake @@ -90,12 +90,7 @@ function(idf_build_get_property variable property) cmake_parse_arguments(ARG "${options}" "${one_value}" "${multi_value}" ${ARGN}) if("${property}" STREQUAL BUILD_COMPONENTS) - # BUILD_COMPONENTS is populated by the Build system v1 compatibility - # shim; reject only when running as a native Build system v2 project. - idf_build_get_property(_v1_compat __V1_COMPAT_SHIM) - if(NOT _v1_compat) - idf_die("Build property 'BUILD_COMPONENTS' is not supported") - endif() + idf_die("Build property 'BUILD_COMPONENTS' is not supported") endif() set(genexpr) diff --git a/tools/cmakev2/project.cmake b/tools/cmakev2/project.cmake index ab8579459c7..f431092e811 100644 --- a/tools/cmakev2/project.cmake +++ b/tools/cmakev2/project.cmake @@ -923,29 +923,12 @@ function(__project_default) set(project_elf "${executable}" PARENT_SCOPE) # Provide Build system v1-compatible build properties so that existing - # test apps and project CMakeLists.txt files that query EXECUTABLE or - # BUILD_COMPONENTS continue to work when built through the shim. + # test apps and project CMakeLists.txt files that query EXECUTABLE + # continue to work when built through the shim. idf_build_get_property(v1_compat __V1_COMPAT_SHIM) if(v1_compat) idf_build_set_property(EXECUTABLE "${executable}") idf_build_set_property(EXECUTABLE_NAME "${executable}") - - # BUILD_COMPONENTS: in Build system v1 this is the set of components - # actually processed during the build (COMPONENTS + their transitive - # REQUIRES within the restricted scope). Use LIBRARY_COMPONENTS_LINKED - # from the Build system v2 library target which reflects the actual - # list of components linked, plus the architecture component which - # Build system v1 always includes but Build system v2 does not track - # as a linked library. - get_target_property(library ${executable} LIBRARY_INTERFACE) - if(library) - idf_library_get_property(linked_components "${library}" LIBRARY_COMPONENTS_LINKED) - idf_build_get_property(target_arch IDF_TARGET_ARCH) - if(target_arch AND NOT target_arch IN_LIST linked_components) - list(APPEND linked_components ${target_arch}) - endif() - idf_build_set_property(BUILD_COMPONENTS "${linked_components}") - endif() endif() if(CONFIG_APP_BUILD_GENERATE_BINARIES AND TARGET idf::esptool_py) diff --git a/tools/test_build_system/buildv2/test_migration.py b/tools/test_build_system/buildv2/test_migration.py index e6eed42f6f1..328149a7499 100644 --- a/tools/test_build_system/buildv2/test_migration.py +++ b/tools/test_build_system/buildv2/test_migration.py @@ -118,3 +118,24 @@ def test_build_components_not_available(idf_py: IdfPyFunc) -> None: check_file = Path('build/build_components_check.txt') assert check_file.exists(), 'Variable check file should be written before the fatal error' assert check_file.read_text().strip() == 'NOT_FOUND', 'BUILD_COMPONENTS variable should not be available in v2' + + +@pytest.mark.usefixtures('test_app_copy') +def test_build_components_rejected_through_shim(idf_py: IdfPyFunc) -> None: + """BUILD_COMPONENTS must be rejected even when building through the compatibility shim.""" + logging.info('Testing BUILD_COMPONENTS rejection through the compatibility shim') + + # Arm the shim via the v1 project.cmake, then query BUILD_COMPONENTS before the graph is configured. + Path('CMakeLists.txt').write_text( + 'cmake_minimum_required(VERSION 3.22)\n' + 'include($ENV{IDF_PATH}/tools/cmake/project.cmake)\n' + 'idf_build_get_property(_bc BUILD_COMPONENTS)\n' + 'project(build_test_app)\n' + ) + + result = idf_py('reconfigure', check=False) + + assert result.returncode != 0, 'reconfigure must fail when BUILD_COMPONENTS is queried through the shim' + combined = (result.stdout or '') + (result.stderr or '') + assert 'BUILD_COMPONENTS' in combined, 'Error output must mention BUILD_COMPONENTS' + assert 'not supported' in combined.lower(), 'Error output must state that BUILD_COMPONENTS is not supported' From be3a19e454a6436d264b49fc8952033801383f6b Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 18 Aug 2026 10:50:58 +0200 Subject: [PATCH 6/7] fix(esp_hal_pmu): include stddef.h for NULL in rtc_cntl_hal --- components/esp_hal_pmu/esp32c2/rtc_cntl_hal.c | 1 + components/esp_hal_pmu/esp32c3/rtc_cntl_hal.c | 1 + components/esp_hal_pmu/esp32s3/rtc_cntl_hal.c | 1 + 3 files changed, 3 insertions(+) diff --git a/components/esp_hal_pmu/esp32c2/rtc_cntl_hal.c b/components/esp_hal_pmu/esp32c2/rtc_cntl_hal.c index 877953a48b5..367dff3edcc 100644 --- a/components/esp_hal_pmu/esp32c2/rtc_cntl_hal.c +++ b/components/esp_hal_pmu/esp32c2/rtc_cntl_hal.c @@ -6,6 +6,7 @@ // The HAL layer for RTC CNTL (common part) +#include #include "soc/soc_caps.h" #include "soc/lldesc.h" #include "hal/rtc_hal.h" diff --git a/components/esp_hal_pmu/esp32c3/rtc_cntl_hal.c b/components/esp_hal_pmu/esp32c3/rtc_cntl_hal.c index 8c92189f7b3..95ff7ed987f 100644 --- a/components/esp_hal_pmu/esp32c3/rtc_cntl_hal.c +++ b/components/esp_hal_pmu/esp32c3/rtc_cntl_hal.c @@ -6,6 +6,7 @@ // The HAL layer for RTC CNTL (common part) +#include #include "soc/soc_caps.h" #include "soc/lldesc.h" #include "hal/dma_types.h" diff --git a/components/esp_hal_pmu/esp32s3/rtc_cntl_hal.c b/components/esp_hal_pmu/esp32s3/rtc_cntl_hal.c index 42ce5eca073..f8a14cc9f6a 100644 --- a/components/esp_hal_pmu/esp32s3/rtc_cntl_hal.c +++ b/components/esp_hal_pmu/esp32s3/rtc_cntl_hal.c @@ -6,6 +6,7 @@ // The HAL layer for RTC CNTL (common part) +#include #include "hal/rtc_hal.h" #include "soc/soc_caps.h" #include "esp32s3/rom/lldesc.h" From dfe99a4a412c4aa6458a632f991cf820802771ab Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Wed, 26 Aug 2026 15:27:33 +0200 Subject: [PATCH 7/7] feat(idf_py): hint at the BUILD_COMPONENTS migration path Reading the BUILD_COMPONENTS build property aborts the build with a bare message stating that the property is unsupported, without naming a replacement. Add a hint that points at the $ generator expression and at the documentation section describing the migration, so the guidance lives with the other build hints instead of being spelled out in the build system sources. --- tools/idf_py_actions/hints.yml | 4 ++++ tools/test_idf_py/error_output.yml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/tools/idf_py_actions/hints.yml b/tools/idf_py_actions/hints.yml index 2dd1fa59acf..fd5acb79643 100644 --- a/tools/idf_py_actions/hints.yml +++ b/tools/idf_py_actions/hints.yml @@ -601,3 +601,7 @@ - re: "undefined reference to `esp_secure_boot_check_signature_on_update'" hint: "CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT requires the startup signature check from the esp_image_verify component, which is not in the build. Add esp_image_verify (or app_update, which includes it) to the calling component's PRIV_REQUIRES or to the project's COMPONENTS list." + +- + re: "Build property 'BUILD_COMPONENTS' is not supported" + hint: "The 'BUILD_COMPONENTS' build property does not exist in Build System v2, since components are not collected before they are evaluated. To check whether a component takes part in the build, use the '$' generator expression instead. For details and a migration example, run 'idf.py docs -sp api-guides/build-system-v2/breaking-changes.html#cmakev2-build-components'" diff --git a/tools/test_idf_py/error_output.yml b/tools/test_idf_py/error_output.yml index 6a157709aef..235c1222a9c 100644 --- a/tools/test_idf_py/error_output.yml +++ b/tools/test_idf_py/error_output.yml @@ -1,3 +1,6 @@ +"CMake Error at /esp-idf/tools/cmakev2/build.cmake:93 (message): IDF: Build property 'BUILD_COMPONENTS' is not supported\n": + "HINT: The 'BUILD_COMPONENTS' build property does not exist in Build System v2, since components are not collected before they are evaluated. To check whether a component takes part in the build, use the '$' generator expression instead. For details and a migration example, run 'idf.py docs -sp api-guides/build-system-v2/breaking-changes.html#cmakev2-build-components'" + 'ccache error: Failed to create temporary file\n': "HINT: On Windows, you should enable long path support in the installer, or disable ccache temporarily. See 'idf.py --help' or the documentation how to achieve this."