10000 py/mkrules: Add GIT_SUBMODULES_FAIL_IF_EMPTY flag for CMake ports. · projectgus/micropython@22353e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 22353e9

Browse files
committed
py/mkrules: Add GIT_SUBMODULES_FAIL_IF_EMPTY flag for CMake ports.
The way CMake gathers the submodule list, it can quietly be empty if the previous step fails. This makes it an explicit error. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 43e3ab6 commit 22353e9

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

ports/esp32/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ size-files:
114114
submodules:
115115
@GIT_SUBMODULES=$$(IDF_COMPONENT_MANAGER=0 idf.py $(IDFPY_FLAGS) -B $(BUILD)/submodules -D ECHO_SUBMODULES=1 build 2>&1 | \
116116
grep '^GIT_SUBMODULES=' | cut -d= -f2); \
117-
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$${GIT_SUBMODULES}" submodules
117+
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$${GIT_SUBMODULES}" GIT_SUBMODULES_FAIL_IF_EMPTY=1 submodules

ports/rp2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ submodules:
7676
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="lib/pico-sdk" submodules
7777
@GIT_SUBMODULES=$$(cmake -B $(BUILD)/submodules -DECHO_SUBMODULES=1 ${CMAKE_ARGS} -S . 2>&1 | \
7878
grep '^GIT_SUBMODULES=' | cut -d= -f2); \
79-
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$${GIT_SUBMODULES}" submodules
79+
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$${GIT_SUBMODULES}" GIT_SUBMODULES_FAIL_IF_EMPTY=1 submodules

py/mkrules.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ ifneq ($(GIT_SUBMODULES),)
257257
$(Q)cd $(TOP) && git submodule sync $(GIT_SUBMODULES)
258258
$(Q)cd $(TOP) && git submodule update --init --filter=blob:none $(GIT_SUBMODULES) || \
259259
git submodule update --init $(GIT_SUBMODULES)
260+
else
261+
ifeq ($(GIT_SUBMODULES_FAIL_IF_EMPTY),1)
262+
# If you see this error, it may mean the internal step run by the port's build
263+
# system to find git submodules has failed. Double-check dependencies are set correctly.
264+
$(ECHO) "Internal build error: The submodule list should not be empty."
265+
exit 1
266+
endif
260267
endif
261268
.PHONY: submodules
262269

0 commit comments

Comments
 (0)
0