From 6a10e41db75bd6074bf01a08d260365e44922f04 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 16 Feb 2022 09:43:05 -0800 Subject: [PATCH] Upgrade IWYU to use clang 13 (#28891) * Upgrade IWYU to use clang 13 * Update by review --- .../dockerfile/grpc_iwyu/Dockerfile.template | 18 +++++++++--------- tools/dockerfile/grpc_iwyu/Dockerfile | 16 ++++++++-------- tools/dockerfile/grpc_iwyu/iwyu.sh | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/templates/tools/dockerfile/grpc_iwyu/Dockerfile.template b/templates/tools/dockerfile/grpc_iwyu/Dockerfile.template index 58e12b7e678..718480c4307 100644 --- a/templates/tools/dockerfile/grpc_iwyu/Dockerfile.template +++ b/templates/tools/dockerfile/grpc_iwyu/Dockerfile.template @@ -14,17 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM debian:11 - - RUN apt-get update && apt-get install -y clang-11 llvm-11-dev libclang-11-dev clang-format-11 jq git cmake python - - ENV CLANG_FORMAT=clang-format-11 + FROM silkeh/clang:13 + # Install prerequisites for the iwyu script + RUN apt-get update && apt-get install -y python3 jq git cmake python zlib1g-dev libtinfo-dev && apt-get clean + + # Install IWYU for Clang 13 RUN git clone https://github.com/include-what-you-use/include-what-you-use.git /iwyu - # latest commit on the clang 11 branch - RUN cd /iwyu && git checkout 5db414ac448004fe019871c977905cb7c2cff23f - - RUN mkdir /iwyu_build && cd /iwyu_build && cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 /iwyu && make + RUN cd /iwyu && git checkout fbd921d6640bf1b18fe5a8a895636215367eb6b9 + RUN mkdir /iwyu_build && cd /iwyu_build ${'\\'} + && cmake -G "Unix Makefiles" /iwyu ${'\\'} + && make ADD iwyu.sh / diff --git a/tools/dockerfile/grpc_iwyu/Dockerfile b/tools/dockerfile/grpc_iwyu/Dockerfile index 2bb0ac465da..8b845965c35 100644 --- a/tools/dockerfile/grpc_iwyu/Dockerfile +++ b/tools/dockerfile/grpc_iwyu/Dockerfile @@ -12,17 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM debian:11 +FROM silkeh/clang:13 -RUN apt-get update && apt-get install -y clang-11 llvm-11-dev libclang-11-dev clang-format-11 jq git cmake python - -ENV CLANG_FORMAT=clang-format-11 +# Install prerequisites for the iwyu script +RUN apt-get update && apt-get install -y python3 jq git cmake python zlib1g-dev libtinfo-dev && apt-get clean +# Install IWYU for Clang 13 RUN git clone https://github.com/include-what-you-use/include-what-you-use.git /iwyu -# latest commit on the clang 11 branch -RUN cd /iwyu && git checkout 5db414ac448004fe019871c977905cb7c2cff23f - -RUN mkdir /iwyu_build && cd /iwyu_build && cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 /iwyu && make +RUN cd /iwyu && git checkout fbd921d6640bf1b18fe5a8a895636215367eb6b9 +RUN mkdir /iwyu_build && cd /iwyu_build \ + && cmake -G "Unix Makefiles" /iwyu \ + && make ADD iwyu.sh / diff --git a/tools/dockerfile/grpc_iwyu/iwyu.sh b/tools/dockerfile/grpc_iwyu/iwyu.sh index 05a8804d83a..0278035b378 100755 --- a/tools/dockerfile/grpc_iwyu/iwyu.sh +++ b/tools/dockerfile/grpc_iwyu/iwyu.sh @@ -37,7 +37,7 @@ xargs -a iwyu_files.txt /iwyu/iwyu_tool.py -p compile_commands_for_iwyu.json -j /iwyu/fix_includes.py --nocomments < iwyu.out || true # reformat sources, since iwyu gets this wrong -xargs -a iwyu_files.txt $CLANG_FORMAT -i +xargs -a iwyu_files.txt ${CLANG_FORMAT:-clang-format} -i # TODO(ctiller): expand this to match the clang-tidy directories: # | grep -E "(^include/|^src/core/|^src/cpp/|^test/core/|^test/cpp/)"