[clang-format] update to v14 (#8490)

This commit is contained in:
Jonathan Hui
2022-12-07 16:23:20 -08:00
parent b9514bf025
commit 351298e85f
5 changed files with 15 additions and 15 deletions
+6 -6
View File
@@ -38,7 +38,7 @@ 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-9 clang-tidy-9 || echo 'WARNING: could not install clang-format-9 and clang-tidy-9, which is useful if you plan to contribute C/C++ code to the OpenThread project.'
sudo apt-get --no-install-recommends install -y clang-format-14 clang-tidy-9 || echo 'WARNING: could not install clang-format-14 and clang-tidy-9, which is useful if you plan to contribute C/C++ code to the OpenThread project.'
# 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.'
@@ -111,11 +111,11 @@ install_packages_brew()
echo 'Installing pretty tools useful for code contributions...'
# add clang-format for pretty
CLANG_FORMAT_VERSION="clang-format version 9"
command -v clang-format-9 || (command -v clang-format && (clang-format --version | grep -q "${CLANG_FORMAT_VERSION}")) || {
brew install llvm@9
sudo ln -s "$(brew --prefix llvm@9)/bin/clang-format" /usr/local/bin/clang-format-9
} || echo 'WARNING: could not install llvm@9, which is useful if you plan to contribute C/C++ code to the OpenThread project.'
CLANG_FORMAT_VERSION="clang-format version 14"
command -v clang-format-14 || (command -v clang-format && (clang-format --version | grep -q "${CLANG_FORMAT_VERSION}")) || {
brew install llvm@14
sudo ln -s "$(brew --prefix llvm@14)/bin/clang-format" /usr/local/bin/clang-format-14
} || echo 'WARNING: could not install llvm@14, 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.'
+5 -5
View File
@@ -27,7 +27,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#
CLANG_FORMAT_VERSION="clang-format version 9.0"
CLANG_FORMAT_VERSION="clang-format version 14.0"
die()
{
@@ -39,18 +39,18 @@ die()
# expand_aliases shell option is set using shopt.
shopt -s expand_aliases
if command -v clang-format-9 >/dev/null; then
alias clang-format=clang-format-9
if command -v clang-format-14 >/dev/null; then
alias clang-format=clang-format-14
elif command -v clang-format >/dev/null; then
case "$(clang-format --version)" in
"$CLANG_FORMAT_VERSION"*) ;;
*)
die "$(clang-format --version); clang-format 9.0 required"
die "$(clang-format --version); clang-format 14.0 required"
;;
esac
else
die "clang-format 9.0 required"
die "clang-format 14.0 required"
fi
clang-format "$@" || die