Skip to content

Commit d01878b

Browse files
automatic sync submodules
1 parent 95d9bb4 commit d01878b

3 files changed

Lines changed: 10 additions & 12 deletions

File tree

.github/workflows/makefile.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- name: Update Submodules
18-
run: make update-submodules
19-
2017
- name: Workspace Build
2118
run: make build
2219

Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all update-submodules dev build test final refresh clean
1+
.PHONY: all sync-submodules dev build test final refresh clean
22
.DEFAULT_GOAL := all
33

44
# TODO Configure these
@@ -29,11 +29,12 @@ FINAL_BUILT := $(MARKER_DIR)/final.built
2929

3030
all: final
3131

32-
update-submodules:
32+
sync-submodules:
33+
@echo "==> Syncing submodules to .gitmodules..."
3334
@git submodule sync
3435
@git submodule update --init --recursive
3536

36-
dev: $(DEV_BUILT)
37+
dev: $(DEV_BUILT) sync-submodules
3738
@echo "==> Entering workspace..."
3839
@$(CONTAINER_ENGINE) run \
3940
--rm \
@@ -51,7 +52,7 @@ dev: $(DEV_BUILT)
5152
$(DEV_IMAGE) \
5253
bash
5354

54-
build: $(BASE_BUILT)
55+
build: $(BASE_BUILT) sync-submodules
5556
@echo "==> Building colcon workspace..."
5657
@$(CONTAINER_ENGINE) run \
5758
--rm \
@@ -61,7 +62,7 @@ build: $(BASE_BUILT)
6162
$(BASE_IMAGE) \
6263
colcon build --symlink-install
6364

64-
test: $(BASE_BUILT)
65+
test: $(BASE_BUILT) sync-submodules
6566
@echo "==> Testing colcon workspace..."
6667
@$(CONTAINER_ENGINE) run \
6768
--rm \
@@ -71,9 +72,9 @@ test: $(BASE_BUILT)
7172
$(BASE_IMAGE) \
7273
colcon test --event-handlers console_cohesion+
7374

74-
final: $(FINAL_BUILT)
75+
final: $(FINAL_BUILT) sync-submodules
7576

76-
$(BASE_BUILT): $(CONTAINERFILE) $(MAKEFI)
77+
$(BASE_BUILT): $(CONTAINERFILE)
7778
@echo "==> Building base image..."
7879
@$(CONTAINER_ENGINE) build \
7980
-t $(BASE_IMAGE) \

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This repository is a template for a containerized [ROS 2](https://docs.ros.org/)
1010
| `make final` | Builds the colcon workspace and copies the resulting artifacts into a minimal `ros-core` image tagged `{name}:{distro}-final`. |
1111
| `make refresh` | Causes the previous set of commands to rebuild the image when run. |
1212
| `make clean` | Untags and removes any installed images. |
13-
| `make update-submodules` | Recursively updates git submodules. |
13+
| `make sync-submodules` | Manually syncs and recursively updates git submodules. |
1414

1515
## Why?
1616

@@ -57,7 +57,7 @@ To add source dependencies, use git submodules inside src. For example:
5757
git submodule add https://github.com/ros2/examples.git src/examples
5858
```
5959

60-
You can edit submodules in `.gitmodules` and pin them to specific commits or branches, and refresh them with `make update-submodules`.
60+
You can edit submodules in `.gitmodules` (full spec [here](https://git-scm.com/docs/gitmodules#_description)), and manually sync them with `make sync-submodules`. By default, all the build commands will ensure the workspace's submodules are synced to `.gitmodules` and updated. If you want to pin submodules to specific versions, you should run `git checkout <commit>` from their directories.
6161

6262
## Questions and Limitations
6363

0 commit comments

Comments
 (0)