partial cherry-pick of 'update clang-format to 5.0'

reviewable/pr12708/r1
Muxi Yan 7 years ago
parent 4a117f0be7
commit f5eb1cf9f0
  1. 2
      .clang-format
  2. 10
      templates/tools/dockerfile/clang_format.include
  3. 10
      tools/dockerfile/grpc_clang_format/Dockerfile
  4. 4
      tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
  5. 10
      tools/dockerfile/test/sanity/Dockerfile

@ -1,5 +1,7 @@
--- ---
Language: Cpp Language: Cpp
BasedOnStyle: Google BasedOnStyle: Google
DerivePointerAlignment: false
PointerAlignment: Left
... ...

@ -1,5 +1,5 @@
RUN apt-get update && apt-get -y install wget RUN apt-get update && apt-get -y install wget xz-utils
RUN echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list RUN wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
RUN echo "deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list RUN tar xf clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - RUN ln -s /clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/clang-format /usr/local/bin/clang-format
RUN apt-get update && apt-get -y install clang-format-3.8 ENV CLANG_FORMAT=clang-format

@ -14,11 +14,11 @@
FROM debian:jessie FROM debian:jessie
RUN apt-get update && apt-get -y install wget RUN apt-get update && apt-get -y install wget xz-utils
RUN echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list RUN wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
RUN echo "deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list RUN tar xf clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - RUN ln -s /clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/clang-format /usr/local/bin/clang-format
RUN apt-get update && apt-get -y install clang-format-3.8 ENV CLANG_FORMAT=clang-format
ADD clang_format_all_the_things.sh / ADD clang_format_all_the_things.sh /
CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"] CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"]

@ -22,14 +22,14 @@ DIRS="src/core/lib src/core/tsi src/core/ext src/cpp test/core test/cpp include
GLOB="*.h *.c *.cc" GLOB="*.h *.c *.cc"
# clang format command # clang format command
CLANG_FORMAT=clang-format-3.8 CLANG_FORMAT=${CLANG_FORMAT:-clang-format-5.0}
files= files=
for dir in $DIRS for dir in $DIRS
do do
for glob in $GLOB for glob in $GLOB
do do
files="$files `find ${CLANG_FORMAT_ROOT}/$dir -name $glob -and -not -name *.generated.* -and -not -name *.pb.h -and -not -name *.pb.c -and -not -name *.pb.cc -and -not -name end2end_tests.c -and -not -name end2end_nosec_tests.c -and -not -name public_headers_must_be_c89.c`" files="$files `find ${CLANG_FORMAT_ROOT}/$dir -name $glob -and -not -name '*.generated.*' -and -not -name '*.pb.h' -and -not -name '*.pb.c' -and -not -name '*.pb.cc' -and -not -name end2end_tests.c -and -not -name end2end_nosec_tests.c -and -not -name public_headers_must_be_c89.c`"
done done
done done

@ -100,11 +100,11 @@ RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.4.4/ba
RUN chmod +x ./bazel-0.4.4-installer-linux-x86_64.sh RUN chmod +x ./bazel-0.4.4-installer-linux-x86_64.sh
RUN ./bazel-0.4.4-installer-linux-x86_64.sh RUN ./bazel-0.4.4-installer-linux-x86_64.sh
RUN apt-get update && apt-get -y install wget RUN apt-get update && apt-get -y install wget xz-utils
RUN echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list RUN wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
RUN echo "deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list RUN tar xf clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - RUN ln -s /clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/clang-format /usr/local/bin/clang-format
RUN apt-get update && apt-get -y install clang-format-3.8 ENV CLANG_FORMAT=clang-format
# Prepare ccache # Prepare ccache
RUN ln -s /usr/bin/ccache /usr/local/bin/gcc RUN ln -s /usr/bin/ccache /usr/local/bin/gcc

Loading…
Cancel
Save