From 9568de303a9f2be4c37a5d2aeb1c2e08c83bf3e5 Mon Sep 17 00:00:00 2001 From: "yongkang.zhong" Date: Thu, 11 May 2023 19:38:58 +0800 Subject: [PATCH] [Chore](build) update clang-format version check (#19542) update clang-format version check --- build-support/check-format.sh | 12 +++++++++--- build-support/clang-format.sh | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/build-support/check-format.sh b/build-support/check-format.sh index 97f620cac7..0e13f0d784 100755 --- a/build-support/check-format.sh +++ b/build-support/check-format.sh @@ -31,11 +31,17 @@ DORIS_HOME=$( ) export DORIS_HOME -if [[ -z $(command -v clang-format-16) ]]; then - echo "clang-format-16 not founded, please install clang-format-16 or upgrade your clang-format version to 16" +if [[ -z $(command -v clang-format) ]]; then + echo "clang-format not found, please install clang-format" exit 1 fi -CLANG_FORMAT="${CLANG_FORMAT_BINARY:=$(command -v clang-format-16)}" +CLANG_FORMAT_VERSION=$(clang-format --version | perl -nle 'print $& if m{version \K[0-9]+}') +if [[ ${CLANG_FORMAT_VERSION} -ne 16 ]]; then + echo "clang-format version is not 16, please install clang-format version 16 or upgrade your clang-format version to 16" + exit 1 +fi + +CLANG_FORMAT="${CLANG_FORMAT_BINARY:=$(command -v clang-format)}" python "${DORIS_HOME}/build-support/run_clang_format.py" "--clang-format-executable" "${CLANG_FORMAT}" "-r" "--style" "file" "--inplace" "false" "--extensions" "c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx" "--exclude" "none" "be/src be/test" diff --git a/build-support/clang-format.sh b/build-support/clang-format.sh index 34de3a32d0..4b27429224 100755 --- a/build-support/clang-format.sh +++ b/build-support/clang-format.sh @@ -31,11 +31,17 @@ DORIS_HOME=$( ) export DORIS_HOME -if [[ -z $(command -v clang-format-16) ]]; then - echo "clang-format-16 not founded, please install clang-format-16 or upgrade your clang-format version to 16" +if [[ -z $(command -v clang-format) ]]; then + echo "clang-format not found, please install clang-format" exit 1 fi -CLANG_FORMAT="${CLANG_FORMAT_BINARY:=$(command -v clang-format-16)}" +CLANG_FORMAT_VERSION=$(clang-format --version | perl -nle 'print $& if m{version \K[0-9]+}') +if [[ ${CLANG_FORMAT_VERSION} -ne 16 ]]; then + echo "clang-format version is not 16, please install clang-format version 16 or upgrade your clang-format version to 16" + exit 1 +fi + +CLANG_FORMAT="${CLANG_FORMAT_BINARY:=$(command -v clang-format)}" python "${DORIS_HOME}/build-support/run_clang_format.py" "--clang-format-executable" "${CLANG_FORMAT}" "-r" "--style" "file" "--inplace" "true" "--extensions" "c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx" "--exclude" "none" "be/src be/test"