diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 6ffa920..2b5a545 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -21,8 +21,8 @@ What differs lies in `shared/`: the names of the volumes, the Jinja extension fo of its own. And the Ubuntu packages a project names in `.devcontainer/apt-packages.txt`, which the repository has only as a template: `shared/install.sh` installs gcc-avr and avr-libc, which `tests/check.sh --no-arduino` and `--firmware` build with, as the template's CI does. The first `tests/check.sh` installs the Arduino core into the volume -`embedded-cpp-template-arduino15`, where it stays; uv's cache, the Codex, Claude Code and gh logins -and the shell history have volumes of their own as well. +`embedded-cpp-template-arduino15`, where it stays; uv's cache, ccache's, the Codex, Claude Code and +gh logins and the shell history have volumes of their own as well. ## Site-specific variants diff --git a/.devcontainer/shared/devcontainer-feature.json b/.devcontainer/shared/devcontainer-feature.json index 824bc72..48f663c 100644 --- a/.devcontainer/shared/devcontainer-feature.json +++ b/.devcontainer/shared/devcontainer-feature.json @@ -73,6 +73,11 @@ "target": "/home/vscode/.cache/uv", "type": "volume" }, + { + "source": "embedded-cpp-template-ccache", + "target": "/home/vscode/.cache/ccache", + "type": "volume" + }, { "source": "embedded-cpp-template-codex", "target": "/home/vscode/.codex", diff --git a/CHANGELOG.md b/CHANGELOG.md index d26cffb..d701e7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,14 @@ brings it. includes, and include-cleaner asked a file that wrote `SREG` for that header, though `` is the one to include. Found in MaxMatrix, which saves and restores `SREG` around a write to a port. - -On the update: nothing to do. A project that added `avr/common.h` to `IgnoreHeaders` itself, or -included it, can drop that. +- **ccache keeps its cache across a rebuild of the dev container:** it lay in + `~/.cache/ccache` on the container's own file system, which a rebuild throws away, so the first + `make check` after one compiled every host build again. The volume `-ccache` keeps + it, as `-uv-cache` keeps uv's. + +On the update: rebuild the dev container; the volume of ccache starts empty and fills with the +first build. A project that added `avr/common.h` to `IgnoreHeaders` itself, or included it, can +drop that. ## v0.12.0 diff --git a/template/.devcontainer/Dockerfile b/template/.devcontainer/Dockerfile index ca4359d..7005dfe 100644 --- a/template/.devcontainer/Dockerfile +++ b/template/.devcontainer/Dockerfile @@ -132,15 +132,17 @@ COPY llvm-headers.sh /tmp/llvm-headers.sh RUN /tmp/llvm-headers.sh "${LLVM_MAJOR}" "/opt/llvm-${LLVM_MAJOR}/include" && \ rm /tmp/llvm-headers.sh -# The Arduino data directory and uv's cache are named volumes: the AVR core and its +# The Arduino data directory, uv's cache and ccache's are named volumes: the AVR core and its # toolchain, and the checkers from PyPI, are downloaded on first use, and the volumes are -# what keep a rebuild from fetching them again. An empty named volume takes its ownership +# what keep a rebuild from fetching them again; ccache's keeps what the host builds compiled, +# which a rebuild would otherwise throw away. An empty named volume takes its ownership # from the path it covers, so the path has to exist and belong to the remote user first, # or nothing can write into it. `install -d` gives only the last component to the owner and # creates missing parents as root, so ~/.cache is named on its own: a base image without it # would otherwise leave it to root, and arduino-cli could not put its build cache there. RUN install -d -o vscode -g vscode -m 0755 /home/vscode/.arduino15 && \ - install -d -o vscode -g vscode -m 0755 /home/vscode/.cache /home/vscode/.cache/uv + install -d -o vscode -g vscode -m 0755 /home/vscode/.cache /home/vscode/.cache/uv \ + /home/vscode/.cache/ccache # The same arrangement for the logins a rebuild would otherwise throw away: Codex and Claude # Code, whose extensions the shared feature installs, and gh, which every push and every pull request diff --git a/template/.devcontainer/README.md.jinja b/template/.devcontainer/README.md.jinja index 0b1dced..95f020d 100644 --- a/template/.devcontainer/README.md.jinja +++ b/template/.devcontainer/README.md.jinja @@ -81,7 +81,8 @@ home; `/usr/local/bin/clangd` links to the binary itself. The Arduino core and its toolchain, and the checkers uv fetches, are not part of the image. They live in the named volumes `{{ namespace }}-arduino15` and `{{ namespace }}-uv-cache`, so that a rebuild does not download them -again. Three more carry a login across a rebuild: `{{ namespace }}-codex` at `/home/vscode/.codex`, +again. What ccache compiled for the host builds lives in `{{ namespace }}-ccache` at `/home/vscode/.cache/ccache`, so +that the first build after a rebuild takes it from there rather than compiling everything again. Three more carry a login across a rebuild: `{{ namespace }}-codex` at `/home/vscode/.codex`, `{{ namespace }}-claude` at `/home/vscode/.claude` (with `CLAUDE_CONFIG_DIR` pointing there, so that Claude Code's `.claude.json` lands in it too) and `{{ namespace }}-gh` at `/home/vscode/.config/gh`, all at mode 0700, as `gh` refuses a config directory others can enter. Those three hold credentials: do not share, export or remove one unless the login should go. diff --git a/template/.devcontainer/shared/devcontainer-feature.json.jinja b/template/.devcontainer/shared/devcontainer-feature.json.jinja index a29dbfe..1458908 100644 --- a/template/.devcontainer/shared/devcontainer-feature.json.jinja +++ b/template/.devcontainer/shared/devcontainer-feature.json.jinja @@ -75,6 +75,11 @@ "target": "/home/vscode/.cache/uv", "type": "volume" }, + { + "source": "{{ namespace }}-ccache", + "target": "/home/vscode/.cache/ccache", + "type": "volume" + }, { "source": "{{ namespace }}-codex", "target": "/home/vscode/.codex",