Auto-initialize git submodules in bundle target#2
Conversation
Co-authored-by: EdgeOfAssembly <223567695+EdgeOfAssembly@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds automatic git submodule initialization to the bundle target, eliminating the need for users to manually run make init before building. The change detects when the bundler script is missing and automatically initializes submodules.
- Adds conditional check for missing
zbundler.pyscript before bundle execution - Auto-initializes git submodules when the bundler script is not found
- Removes manual initialization step from the workflow for fresh repository clones
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @echo "Bundling $(DIST_HEADER)..." | ||
| @if [ ! -f $(BUNDLER) ]; then \ | ||
| echo "Initializing git submodules..."; \ | ||
| git submodule update --init --recursive; \ |
There was a problem hiding this comment.
The git submodule update --init --recursive command could fail (e.g., network issues, invalid git repository), but this failure would not stop the make process. The subsequent python3 $(BUNDLER) command would still execute and fail with a confusing error message.
Consider adding error handling by appending || exit 1 to the git command:
@if [ ! -f $(BUNDLER) ]; then \
echo "Initializing git submodules..."; \
git submodule update --init --recursive || exit 1; \
fiThis ensures the build fails immediately with a clear error if submodule initialization fails.
| git submodule update --init --recursive; \ | |
| git submodule update --init --recursive || exit 1; \ |
The
make bundlecommand fails withNo such file or directorywhen thez-coresubmodule containingzbundler.pyis uninitialized in fresh clones.Changes
bundletarget to detect missing bundler script and auto-initialize submodules viagit submodule update --init --recursiveBehavior
All targets depending on
bundle(bench_c,bench_optimized,lua, etc.) now work without manual intervention.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.