Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ brings it.
`~/.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 `<namespace>-ccache` keeps
it, as `<namespace>-uv-cache` keeps uv's.
- **`make setup` tries a download three times:** arduino-cli gives up at once where a server
resets the connection, and a single reset of `core update-index` failed the dev container's
`postCreateCommand` on a rebuild of MaxMatrix; VS Code then skipped everything after it, the
compilation databases, and on that attach the copy of `.gitconfig` and `gh auth setup-git`.
`download` in `tools/common.sh` runs a command that downloads again after 10 and 20 seconds;
arduino-cli's setup and PlatformIO's go through it, and a third failure still fails.

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
Expand Down
2 changes: 1 addition & 1 deletion template/tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
21 changes: 21 additions & 0 deletions template/tools/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions template/tools/lib/arduino_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion template/tools/lib/platformio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading