Skip to content

Commit 7d16042

Browse files
committed
Install llvm repository for newer versions of clang-format
1 parent d23b9ad commit 7d16042

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

industrial_ci/src/tests/clang_format_check.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ function run_clang_format_check() {
2828
local clang_format_executable="clang-format${CLANG_FORMAT_VERSION:+-$CLANG_FORMAT_VERSION}"
2929

3030
ici_time_start install_clang_format
31+
32+
# Install llvm repository to install the correct clang version if not supported by default on the distro
33+
ici_cmd apt-cache search --names-only "$clang_format_executable"
34+
ici_cmd apt-cache search --names-only "$clang_format_executable" | grep "clang"
35+
if ! apt-cache search --names-only "$clang_format_executable" | grep -q "clang"; then
36+
ici_install_pkgs_for_command wget wget
37+
ici_apt_install lsb-release software-properties-common gnupg
38+
ici_cmd wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh
39+
ici_cmd chmod +x /tmp/llvm.sh
40+
ici_cmd /tmp/llvm.sh "$CLANG_FORMAT_VERSION"
41+
fi
42+
3143
ici_apt_install git-core "$clang_format_executable"
3244
ici_time_end # install_clang_format
3345

0 commit comments

Comments
 (0)