mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Provide the analysis tools our CI images carry: `clang-tidy` to run the checks in `.clang-tidy`, `clang-tools` for `scan-build`, and `clazy`, the compiler our Clazy job builds with. Name the version of `clang-tidy` our checks are written against rather than install Ubuntu's unversioned package, which is a release behind and reports `cmake-use-cmsys-fstream` where it should not. `CMakeLists.txt` searches for `clang-tidy` only under the unversioned name, so link the version installed by name to it, as we already do for `clang-format`. `clazy` and `clang-tools` remain whatever versions Ubuntu carries rather than the ones the CI image does, so expect their diagnostics to differ from those jobs'. CMake's own clang-tidy checks are not available either way: `CMake_USE_CLANG_TIDY_MODULE` needs `Utilities/ClangTidyModule` built against Clang's development files, which are not installed here. Suggested-by: Tyler Yankee <tyler.yankee@kitware.com>
31 lines
1.3 KiB
Bash
Executable File
31 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Install the packages listed in `deps_packages.lst` and `dev_packages.lst`.
|
|
# See `Help/dev/devcontainer.rst`.
|
|
|
|
set -e
|
|
|
|
# Install without asking questions, e.g. the time zone `tzdata` wants.
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Unlike our CI images, keep the documentation that packages carry: the base
|
|
# image excludes man pages and the like, which is not what one wants in a
|
|
# development environment. Packages already installed in the base image
|
|
# remain without their documentation; `unminimize` restores that.
|
|
rm -f /etc/dpkg/dpkg.cfg.d/excludes
|
|
|
|
apt-get update
|
|
apt-get install -y $(grep -h '^[^#]\+$' /root/deps_packages.lst /root/dev_packages.lst)
|
|
|
|
# Add locales, the way our CI images do, for the tests that need them.
|
|
sed -i -E '/^# en_US[ .](ISO-8859-1|UTF-8)( |$)/ s/^# //' /etc/locale.gen
|
|
dpkg-reconfigure --frontend=noninteractive locales
|
|
|
|
# `Utilities/Scripts/clang-format.bash` finds `clang-format-18` by name, but
|
|
# make the unversioned name resolve to version 18 as well so that tools
|
|
# looking for it get the version our style rules require. `CMakeLists.txt`
|
|
# searches for `clang-tidy` only under the unversioned name, so the version
|
|
# installed by name needs one too.
|
|
ln -s "$(command -v clang-format-18)" /usr/local/bin/clang-format
|
|
ln -s "$(command -v clang-tidy-22)" /usr/local/bin/clang-tidy
|