From 6df7fb8ad3982130cc5a24fbcec98b9230e0b752 Mon Sep 17 00:00:00 2001 From: virskl Date: Mon, 16 Nov 2026 17:29:10 +0100 Subject: [PATCH] copier update: the template at v0.12.1 ccache's cache in a volume of its own, make setup tries a download three times, and IgnoreHeaders leaves out avr/common.h, which MaxMatrix had added as its own exception in #113 and now drops. One conflict, in that pattern of .clang-tidy: the template's text with MaxMatrix's own patterns after it. --- .clang-tidy | 14 +++++++------ .copier-answers.yml | 2 +- .devcontainer/Dockerfile | 8 ++++--- .devcontainer/README.md | 3 ++- .../shared/devcontainer-feature.json | 5 +++++ OIL.md | 2 +- tools/README.md | 2 +- tools/common.sh | 21 +++++++++++++++++++ tools/lib/arduino_cli.sh | 4 ++-- tools/lib/platformio.sh | 2 +- 10 files changed, 47 insertions(+), 16 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 341c323..f48504c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -176,13 +176,15 @@ CheckOptions: # it, at times through a second one, as iom2560.h through iomxx0_1.h, which # include-cleaner does not take back to . Any core's folder, not # only cores/arduino/ of Arduino's: a third party's core has its own, as - # cores/xmega/ of XMegaForArduino's, where Serial comes from. + # cores/xmega/ of XMegaForArduino's, where Serial comes from. And + # avr/common.h, which includes as well, for the registers every + # AVR has, SREG and the stack pointer among them. # MaxMatrix's own, at the end, alike: a header that a public one includes and - # include-cleaner takes for the provider of a name. avr/common.h, SREG's, - # which includes; glibc's bits/ and sys/poll.h, which , - # and include; Linux's asm-generic/, through - # ; and the port of wxWidgets, wx/gtk/ and wx/generic/, which - # wx/panel.h or wx/app.h include, and which a build on Windows does not have. + # include-cleaner takes for the provider of a name. glibc's bits/ and + # sys/poll.h, which , and include; Linux's + # asm-generic/, through ; and the port of wxWidgets, wx/gtk/ and + # wx/generic/, which wx/panel.h or wx/app.h include, and which a build on + # Windows does not have. misc-include-cleaner.IgnoreHeaders: '.*/cores/[^/]+/.*;.*/variants/.*;.*/avr/io[^/]*\.h;.*/avr/common\.h;.*/bits/.*;.*/sys/poll\.h;.*/asm-generic/.*;.*/wx/(gtk|generic)/.*' # Google's names, which readability-identifier-naming checks only once it is told them; the # same block in every project, so that every project names alike. Two exceptions Google diff --git a/.copier-answers.yml b/.copier-answers.yml index ecf884d..1f49411 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,6 +1,6 @@ # The answers this project was made from, which `copier update` reads. Change one with # `copier update --data name=value`, not here. -_commit: v0.12.0 +_commit: v0.12.1 _src_path: gh:theAndreas/embedded-cpp-template arduino: true arduino_core: arduino:avr@1.8.8 diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ca4359d..7005dfe 100644 --- a/.devcontainer/Dockerfile +++ b/.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/.devcontainer/README.md b/.devcontainer/README.md index cf05f70..0e10bf3 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -75,7 +75,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 `max_matrix-arduino15` and `max_matrix-uv-cache`, so that a rebuild does not download them -again. Three more carry a login across a rebuild: `max_matrix-codex` at `/home/vscode/.codex`, +again. What ccache compiled for the host builds lives in `max_matrix-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: `max_matrix-codex` at `/home/vscode/.codex`, `max_matrix-claude` at `/home/vscode/.claude` (with `CLAUDE_CONFIG_DIR` pointing there, so that Claude Code's `.claude.json` lands in it too) and `max_matrix-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/.devcontainer/shared/devcontainer-feature.json b/.devcontainer/shared/devcontainer-feature.json index 5b313be..bd09f24 100644 --- a/.devcontainer/shared/devcontainer-feature.json +++ b/.devcontainer/shared/devcontainer-feature.json @@ -75,6 +75,11 @@ "target": "/home/vscode/.cache/uv", "type": "volume" }, + { + "source": "max_matrix-ccache", + "target": "/home/vscode/.cache/ccache", + "type": "volume" + }, { "source": "max_matrix-codex", "target": "/home/vscode/.codex", diff --git a/OIL.md b/OIL.md index 513dea1..0f1ecd6 100644 --- a/OIL.md +++ b/OIL.md @@ -1050,7 +1050,7 @@ A first look found, besides those two: Where include-cleaner takes for a name's provider a header that a public one includes, `IgnoreHeaders` leaves it out, as the template does for `avr/io*.h`, decided on 2026-11-16 against a NOLINT on each of some 20 lines: `avr/common.h`, where `SREG` is, which the - template's pattern misses as well and is the template's to take up; glibc's `bits/` and + template's pattern missed as well and has since v0.12.1; glibc's `bits/` and `sys/poll.h`, Linux's `asm-generic/`, and the GTK port of wxWidgets. Six includes that the check takes for unused stay, with `// IWYU pragma: keep`: four of wxWidgets that only include the port's header, `` for `timeval`, and `MaxMatrixConfig.h` in diff --git a/tools/README.md b/tools/README.md index c2801b5..d9cad3d 100644 --- a/tools/README.md +++ b/tools/README.md @@ -21,7 +21,7 @@ through. | `self_contained_headers.py` | `make headers`: every header compiled on its own | | `docs.sh` | `make docs`: Doxygen, failing on a gap | | `arduino_lint.sh` | `make arduino-lint` | -| `common.sh` | What the shell scripts share: the paths, the defaults of `project.sh`, the targets, `select_target()` and the `target_` functions each build system answers. A script of the project's own sources it as well | +| `common.sh` | What the shell scripts share: the paths, the defaults of `project.sh`, the targets, `select_target()`, the `target_` functions each build system answers, and `download`, which tries a download three times. A script of the project's own sources it as well | | `project.sh` | The project's: the targets, each with its board and core, the variants and the hooks | | `project.mk` | The project's: its own targets of the `Makefile` | | `lib/` | What the scripts above call, a target of none: `arduino_cli.sh`, `cmake.sh` and `platformio.sh`, the build systems of those names, for the scripts that build a target, and `clang_database.py`, which rewrites the database of a CMake or a PlatformIO build for clang-tidy; `doc_indent.py` and `cpplint_house.py`, cpplint with the NOLINT of a check of our own, for `lint.sh`, `tidy_module.sh` and the clang-tidy module in `tidy_module/` for `tidy.sh`, and `tidy_cache.py`, through which it calls clang-tidy and which skips a file that passed before on the same input | diff --git a/tools/common.sh b/tools/common.sh index 56e2cfe..fae5b7c 100755 --- a/tools/common.sh +++ b/tools/common.sh @@ -103,6 +103,27 @@ err() { echo "$*" >&2 } +# Runs a command that downloads, and again where it fails: a server resets a connection at times, +# and arduino-cli gives up at once, which failed the dev container's postCreateCommand and +# everything after it. Three tries, 10 and 20 seconds apart; the third's failure is returned. +# Arguments: +# the command and its arguments +download() { + local pause=10 + local try + local status + for try in 1 2 3; do + status=0 + "$@" || status=$? + if ((status == 0 || try == 3)); then + return "${status}" + fi + err "Failed with ${status}: $*. Again in ${pause} s (try ${try} of 3)." + sleep "${pause}" + pause=$((pause * 2)) + done +} + # Makes the target named the one the tools work on: TARGET is its name, and the settings of # TARGET_SETTINGS are those of tools/project.sh with what target_settings() sets for it. Fails on # a target TARGETS does not name or whose name is no folder's, and on a build system the template diff --git a/tools/lib/arduino_cli.sh b/tools/lib/arduino_cli.sh index ceb0e58..dd68cc5 100644 --- a/tools/lib/arduino_cli.sh +++ b/tools/lib/arduino_cli.sh @@ -37,8 +37,8 @@ arduino_cli_setup() { if [[ -n "${ARDUINO_BOARD_URLS}" ]]; then urls=(--additional-urls "${ARDUINO_BOARD_URLS}") fi - arduino-cli core update-index "${urls[@]}" - arduino-cli core install "${ARDUINO_CORE[@]}" "${urls[@]}" + download arduino-cli core update-index "${urls[@]}" + download arduino-cli core install "${ARDUINO_CORE[@]}" "${urls[@]}" } # Prints the bin directory of the avr-gcc that arduino-cli uses for FQBN. diff --git a/tools/lib/platformio.sh b/tools/lib/platformio.sh index c981b78..12a6f67 100644 --- a/tools/lib/platformio.sh +++ b/tools/lib/platformio.sh @@ -32,7 +32,7 @@ platformio_setup() { err "Target ${TARGET}: PIO_DIR=${PIO_DIR} holds no platformio.ini." return 1 fi - "${PIO[@]}" pkg install --silent -d "${ROOT_DIR}/${PIO_DIR}" -e "${PIO_ENV}" + download "${PIO[@]}" pkg install --silent -d "${ROOT_DIR}/${PIO_DIR}" -e "${PIO_ENV}" } # Prints the build folder of a variant.