mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 09:57:47 +00:00
[format] standardize clang-format to 19.1.7 (#11797)
Since llvm-19, if we use package manager to install it, the minor versions could be different. This commit standardizes the version on linux to 19.1.7. This version is the same as the one installed by homebrew.
This commit is contained in:
+19
-14
@@ -33,6 +33,8 @@
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
INSTALL_FORMAT_TOOLS="${INSTALL_FORMAT_TOOLS:-1}"
|
||||
|
||||
LLVM_MAJOR_VERSION="19"
|
||||
|
||||
install_packages_pretty_format()
|
||||
@@ -40,7 +42,8 @@ install_packages_pretty_format()
|
||||
echo 'Installing pretty tools useful for code contributions...'
|
||||
|
||||
# add clang-format and clang-tidy for pretty
|
||||
sudo apt-get --no-install-recommends install -y clang-format-"${LLVM_MAJOR_VERSION}" clang-tidy-"${LLVM_MAJOR_VERSION}" || echo "WARNING: could not install clang-format-${LLVM_MAJOR_VERSION} and clang-tidy-${LLVM_MAJOR_VERSION}, which is useful if you plan to contribute C/C++ code to the OpenThread project."
|
||||
# To standardize the llvm version, we don't use apt to install
|
||||
sudo bash "$(dirname "$0")/install-llvm.sh"
|
||||
|
||||
# add yapf for pretty
|
||||
python3 -m pip install yapf==0.31.0 || echo 'WARNING: could not install yapf, which is useful if you plan to contribute python code to the OpenThread project.'
|
||||
@@ -78,7 +81,7 @@ install_packages_apt()
|
||||
&& sudo ln -s -f /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/* /usr/local/bin/.)
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM" != "Raspbian" ]; then
|
||||
if [ "$PLATFORM" != "Raspbian" ] && [ "${INSTALL_FORMAT_TOOLS}" = "1" ]; then
|
||||
install_packages_pretty_format
|
||||
fi
|
||||
}
|
||||
@@ -112,20 +115,22 @@ install_packages_brew()
|
||||
echo 'warning: please install Command Line Tools from https://developer.apple.com/download/more/'
|
||||
fi
|
||||
|
||||
echo 'Installing pretty tools useful for code contributions...'
|
||||
if [ "$INSTALL_FORMAT_TOOLS" = "1" ]; then
|
||||
echo 'Installing pretty tools useful for code contributions...'
|
||||
|
||||
# add clang-format for pretty
|
||||
CLANG_FORMAT_VERSION="clang-format version ${LLVM_MAJOR_VERSION}"
|
||||
command -v clang-format-"${LLVM_MAJOR_VERSION}" || (command -v clang-format && (clang-format --version | grep -q "${CLANG_FORMAT_VERSION}")) || {
|
||||
brew install llvm@"${LLVM_MAJOR_VERSION}"
|
||||
sudo ln -s "$(brew --prefix llvm@${LLVM_MAJOR_VERSION})/bin/clang-format" /usr/local/bin/clang-format-"${LLVM_MAJOR_VERSION}"
|
||||
sudo ln -s "$(brew --prefix llvm@${LLVM_MAJOR_VERSION})/bin/clang-tidy" /usr/local/bin/clang-tidy-"${LLVM_MAJOR_VERSION}"
|
||||
sudo ln -s "$(brew --prefix llvm@${LLVM_MAJOR_VERSION})/bin/clang-apply-replacements" /usr/local/bin/clang-apply-replacements-"${LLVM_MAJOR_VERSION}"
|
||||
sudo ln -s "$(brew --prefix llvm@${LLVM_MAJOR_VERSION})/bin/run-clang-tidy" /usr/local/bin/run-clang-tidy-"${LLVM_MAJOR_VERSION}"
|
||||
} || echo "WARNING: could not install llvm@${LLVM_MAJOR_VERSION}, which is useful if you plan to contribute C/C++ code to the OpenThread project."
|
||||
# add clang-format for pretty
|
||||
CLANG_FORMAT_VERSION="clang-format version ${LLVM_MAJOR_VERSION}"
|
||||
command -v clang-format-"${LLVM_MAJOR_VERSION}" || (command -v clang-format && (clang-format --version | grep -q "${CLANG_FORMAT_VERSION}")) || {
|
||||
brew install llvm@"${LLVM_MAJOR_VERSION}"
|
||||
sudo ln -s "$(brew --prefix llvm@${LLVM_MAJOR_VERSION})/bin/clang-format" /usr/local/bin/clang-format-"${LLVM_MAJOR_VERSION}"
|
||||
sudo ln -s "$(brew --prefix llvm@${LLVM_MAJOR_VERSION})/bin/clang-tidy" /usr/local/bin/clang-tidy-"${LLVM_MAJOR_VERSION}"
|
||||
sudo ln -s "$(brew --prefix llvm@${LLVM_MAJOR_VERSION})/bin/clang-apply-replacements" /usr/local/bin/clang-apply-replacements-"${LLVM_MAJOR_VERSION}"
|
||||
sudo ln -s "$(brew --prefix llvm@${LLVM_MAJOR_VERSION})/bin/run-clang-tidy" /usr/local/bin/run-clang-tidy-"${LLVM_MAJOR_VERSION}"
|
||||
} || echo "WARNING: could not install llvm@${LLVM_MAJOR_VERSION}, which is useful if you plan to contribute C/C++ code to the OpenThread project."
|
||||
|
||||
# add yapf for pretty
|
||||
python3 -m pip install yapf || echo 'Failed to install python code formatter yapf. Install it manually if you need.'
|
||||
# add yapf for pretty
|
||||
python3 -m pip install yapf || echo 'Failed to install python code formatter yapf. Install it manually if you need.'
|
||||
fi
|
||||
|
||||
brew install include-what-you-use || echo 'WARNING: iwyu, which is useful to ensure applying the IWYU rules.'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user