Skip to content

Commit 69a40de

Browse files
committed
[nrf fromtree] sysbuild: populate build_info with list of images
Populate the build_info.yml created by sysbuild CMake with list of images and write the build info file afterwards. This allows users and external tools to examine which images was included in the build even if one or more of those images fails CMake configure or generate stage. Signed-off-by: Torsten Rasmussen <[email protected]> (cherry picked from commit 642e948)
1 parent 9a88142 commit 69a40de

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

share/sysbuild/cmake/modules/sysbuild_images.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@
55
# This module is responsible for including images into sysbuild and to call
66
# pre and post hooks.
77

8+
# Internal function to update build info with list of images abnd write the file.
9+
# Main reason for using an internal function is to properly scope variable usage.
10+
# Function takes a list of images.
11+
function(sysbuild_info_image images)
12+
set(info_image_list)
13+
foreach(image ${images})
14+
ExternalProject_Get_Property(${image} SOURCE_DIR)
15+
get_target_property(type ${image} APP_TYPE)
16+
if(type)
17+
list(APPEND info_image_list MAP "name: ${image}, source-dir: ${SOURCE_DIR}, type: ${type}")
18+
else()
19+
list(APPEND info_image_list MAP "name: ${image}, source-dir: ${source_dir}")
20+
endif()
21+
endforeach()
22+
build_info(images VALUE ${info_image_list})
23+
# Save current state of build info. This allow external tools to fetch sysbuild controlled images
24+
# even in the event that one or more image fails configuration stage.
25+
yaml_save(NAME build_info)
26+
endfunction()
27+
828
get_filename_component(APP_DIR ${APP_DIR} ABSOLUTE)
929
get_filename_component(app_name ${APP_DIR} NAME)
1030
set(DEFAULT_IMAGE "${app_name}")
@@ -15,6 +35,9 @@ sysbuild_add_subdirectory(${sysbuild_toplevel_SOURCE_DIR}/images sysbuild/images
1535
get_property(IMAGES GLOBAL PROPERTY sysbuild_images)
1636
sysbuild_module_call(PRE_CMAKE MODULES ${SYSBUILD_MODULE_NAMES} IMAGES ${IMAGES})
1737
sysbuild_images_order(IMAGES_CONFIGURATION_ORDER CONFIGURE IMAGES ${IMAGES})
38+
39+
sysbuild_info_image("${IMAGES}")
40+
1841
foreach(image ${IMAGES_CONFIGURATION_ORDER})
1942
sysbuild_module_call(PRE_IMAGE_CMAKE MODULES ${SYSBUILD_MODULE_NAMES} IMAGES ${IMAGES} IMAGE ${image})
2043
ExternalZephyrProject_Cmake(APPLICATION ${image})

0 commit comments

Comments
 (0)