Skip to content

Commit 61bced3

Browse files
CopilotJohnAmadis
andcommitted
Fix CI: skip main module download if already listed in flash.dmd
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
1 parent e4cec7b commit 61bced3

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

modules/CMakeLists.txt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,30 @@ if(DMBOOT_FLASH_DMD_FILES)
112112
endif()
113113
endforeach()
114114

115-
# Download main module if specified (at the end of installation)
115+
# Download main module if specified (at the end of installation),
116+
# but only if it is not already listed in any flash.dmd file
116117
if(DMBOOT_MAIN_MODULE)
117-
append_main_module_download_commands(_FLASH_DOWNLOAD_COMMANDS)
118+
set(_MAIN_MODULE_IN_FLASH_DMD FALSE)
119+
foreach(_DMD_FILE IN LISTS DMBOOT_FLASH_DMD_FILES)
120+
file(STRINGS "${_DMD_FILE}" _DMD_LINES)
121+
foreach(_LINE IN LISTS _DMD_LINES)
122+
string(STRIP "${_LINE}" _LINE_STRIPPED)
123+
if(NOT _LINE_STRIPPED MATCHES "^#" AND NOT _LINE_STRIPPED STREQUAL "")
124+
if(_LINE_STRIPPED STREQUAL "${DMBOOT_MAIN_MODULE}")
125+
set(_MAIN_MODULE_IN_FLASH_DMD TRUE)
126+
break()
127+
endif()
128+
endif()
129+
endforeach()
130+
if(_MAIN_MODULE_IN_FLASH_DMD)
131+
break()
132+
endif()
133+
endforeach()
134+
if(NOT _MAIN_MODULE_IN_FLASH_DMD)
135+
append_main_module_download_commands(_FLASH_DOWNLOAD_COMMANDS)
136+
else()
137+
message(STATUS "Main module '${DMBOOT_MAIN_MODULE}' is already listed in flash.dmd, skipping explicit download")
138+
endif()
118139
endif()
119140

120141
list(APPEND _FLASH_DOWNLOAD_COMMANDS

0 commit comments

Comments
 (0)