-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
extmod,rp2,esp32: Rework CMake discovery of the git submodule list for "make submodules" #16901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extmod,rp2,esp32: Rework CMake discovery of the git submodule list for "make submodules" #16901
Conversation
The existing method of grepping the output of CMake still masks errors that can occur if something else in the build isn't working. This is hard to debug. Commit 22353e9 added an error message, but the root cause of the failure is still hidden. Instead of capturing stdout, have CMake write a shell snippet in the build directory and then source it to set GIT_SUBMODULES in Make. This way stdout/stderr are no longer masked off, and the build will fail normally if something goes wrong. This reverts both commit 22353e9 (empty submodule list is no longer a symptom of something else) and commit ec527a1 (CMake can now return normally instead of fail, so the problem with IDF Component Manager is no longer triggered.) This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
@asdil12 any chance you're able to test this PR, please? @hmaerki heads-up about another build change related to submodules. This shouldn't impact your work but it may. A pre-merge test would be appreciated if you have time. 😁 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #16901 +/- ##
=======================================
Coverage 98.54% 98.54%
=======================================
Files 169 169
Lines 21877 21877
=======================================
Hits 21558 21558
Misses 319 319 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code size report:
|
I already tried it yesterday using the master and a fresh git checkout at a new location. |
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
OK, this got a lot fiddlier than expected. Closing and going with this approach:
|
Summary
Fixes #16870.
The existing method of grepping the output of CMake still masks errors that can occur if something else in the build isn't working. This is hard to debug. Commit 22353e9 in #16581 added an error message, but the root cause of the failure is still hidden.
Instead of capturing stdout, have CMake write a shell snippet in the build directory and then source it to set GIT_SUBMODULES in Make. This way stdout/stderr are no longer masked off, and the build will fail normally if something goes wrong.
This reverts both commits from #16581:
This work was funded through GitHub Sponsors.
Testing
podman run --rm -t -v "/home/gus/ry/george/micropython/.git:/gitdir:ro" -t docker.io/espressif/idf:v5.2.2 bash -c "export BOARD=ESP32_GENERIC_S3; git clone -b $(git branch --show-current) /gitdir micropython && make -j -C micropython/mpy-cross && echo '@@@@@@@@@@ submodules' && make -C micropython/ports/esp32 submodules V=1 BOARD=$BOARD && echo '@@@@@@@@@@ main build' && make -C micropython/ports/esp32"
)Trade-offs and Alternatives
make submodules
run now prints some CMake informational messages, so it's noiser. Could potentially add-q
to reduce this (or to reduce it unlessV=1
is set), but I haven't done this as I don't want to mask useful build context.git submodules
, we could delegate runninggit submodules
to CMake. The "submodules" target inpy/mkrules.mk
is very small, we might end up with less lines of code overall by duplicating it in CMake.GIT_SUBMODULES
value inrp2/Makefile
andesp32/Makefile
. The upside is a much simpler build stage. There are two downsides I can see: