Skip to content

Commit

Permalink
fix: remove -10 suffix for clang-tidy and clang-format in install_d…
Browse files Browse the repository at this point in the history
…eps.sh

Default llvm toolchain version in Ubuntu 20.04 is 10, while Ubuntu 22.04
does not have `clang-tidy-10` or `clang-format-10` by default.

issue: #33142

Signed-off-by: Yinzuo Jiang <[email protected]>
  • Loading branch information
jiangyinzuo committed May 18, 2024
1 parent c81be9e commit 646378b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/design_docs/segcore/scripts_and_tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The following scripts and commands may be used during segcore development.
## code format

- under milvus/internal/core directory
- run `./run_clang_format .` to format cpp code
- run `./run_clang_format.sh .` to format cpp code
- to call clang-format-10, need to install `apt install clang-format-10` in advance
- call `build-support/add_${lang}_license.sh` to add license info for cmake and cpp files
- under milvus/ directory
Expand Down
9 changes: 8 additions & 1 deletion internal/core/run_clang_format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ else
fi
CorePath=$1

# Check if clang-format-10 exists
if command -v clang-format-10 >/dev/null 2>&1; then
ClangFormatCmd=clang-format-10
else
ClangFormatCmd=clang-format
fi

formatThis() {
find "$1" | grep -E "(*\.cpp|*\.h|*\.cc)$" | grep -v "gen_tools/templates" | grep -v "\.pb\." | grep -v "tantivy-binding.h" | xargs clang-format-10 -i
find "$1" | grep -E "(*\.cpp|*\.h|*\.cc)$" | grep -v "gen_tools/templates" | grep -v "\.pb\." | grep -v "tantivy-binding.h" | xargs $ClangFormatCmd -i
}

formatThis "${CorePath}/src"
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function install_linux_deps() {
# for Ubuntu 20.04
sudo apt install -y wget curl ca-certificates gnupg2 \
g++ gcc gfortran git make ccache libssl-dev zlib1g-dev zip unzip \
clang-format-10 clang-tidy-10 lcov libtool m4 autoconf automake python3 python3-pip \
clang-format clang-tidy lcov libtool m4 autoconf automake python3 python3-pip \
pkg-config uuid-dev libaio-dev libopenblas-dev libgoogle-perftools-dev

sudo pip3 install conan==1.61.0
Expand Down

0 comments on commit 646378b

Please sign in to comment.