-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
rp2,esp32,extmod: Implement submodule update inside CMake. #16907
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
rp2,esp32,extmod: Implement submodule update inside CMake. #16907
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #16907 +/- ##
=======================================
Coverage 98.54% 98.54%
=======================================
Files 169 169
Lines 21890 21890
=======================================
Hits 21571 21571
Misses 319 319 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
535a3ac
to
6cfa54b
Compare
Code size report:
|
bc1d0c8
to
4169684
Compare
Rather than having Make calling CMake to generate a list of submodules and then run a Make target (which is complex and prone to masking other errors), implement the submodule update logic in CMake itself. Internal CMake-side changes are that GIT_SUBMODULES is now a CMake list, and the trigger variable name is changed from ECHO_SUBMODULES to UPDATE_SUBMODULES. The run is otherwise 100% a normal CMake run now, so most of the other special casing can be removed. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
4169684
to
50da085
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice improvement, definitely a lot cleaner this way (than printing the submodules and using make to updated them).
Tested with various rp2 boards, including ARDUINO_NANO_RP2040_CONNECT which needs mynewt-nimble.
Summary
Alternative approach to #16901. Fixes #16870.
Rather than having
make submodules
run CMake to get the submodules list and then update git submodules, have CMake update submodules itself. This means any other build errors will be visible, rather than being masked (as currently the CMake submodules run has its output captured and parsed.)This effectively reverts commit 22353e9 from #16581, as an empty submodule list is no longer a symptom of any deeper (masked) issue.
It's also possible to simplify out a lot of the checks for
ECHO_SUBMODULES
as CMake won't check if those files and directories exist until after theUPDATE_SUBMODULES
pass finishes. A workaround is still needed for ESP32 as the ESP-IDF framework tests if paths exist when registering a new component, but the workaround can be contained in the esp32_common.cmake file.This PR also contains a commit to fail with a helpful error message if the pico-sdk is missing. This was originally necessary because I was trying to run the
UPDATE_SUBMODULES
pass in the normal build directory (to save on running CMake twice), but that actually doesn't quite work as pico-sdk sets some other invalid cache values if directories are missing. However, the helpful error message is still helpful!Testing
podman run --rm -t -v "/home/gus/ry/george/micropython/.git:/gitdir:ro" -t docker.io/espressif/idf:v5.2.2 bash -c "git clone -b $(git branch --show-current) /gitdir micropython && make -j -C micropython/mpy-cross && echo '@@@@@@@@@@ submodules' && make -C microp ython/ports/esp32 submodules V=1 BOARD=ESP32_GENERIC_S3 && echo '@@@@@@@@@@ main build' && make -C micropython/ports/esp32 BOARD=ESP32_GENERIC_S3"
Trade-offs and Alternatives
make submodules
output now includes a lot of CMake build output for a dummy run which never gets to actually build.GIT_SUBMODULES
value inrp2/Makefile
andesp32/Makefile
. The upside is a much simpler build stage. There are two downsides I can see: