diff --git a/.clang-format b/.clang-format index 4b3f13fa55e..3b2451958b3 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,7 @@ --- Language: Cpp BasedOnStyle: Google +DerivePointerAlignment: false +PointerAlignment: Left ... diff --git a/templates/tools/dockerfile/clang_format.include b/templates/tools/dockerfile/clang_format.include index 81bd2be797b..79d0ff286f8 100644 --- a/templates/tools/dockerfile/clang_format.include +++ b/templates/tools/dockerfile/clang_format.include @@ -1,5 +1,5 @@ -RUN apt-get update && apt-get -y install wget -RUN echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list -RUN echo "deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list -RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - -RUN apt-get update && apt-get -y install clang-format-3.8 +RUN apt-get update && apt-get -y install wget xz-utils +RUN wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz +RUN tar xf clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz +RUN ln -s /clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/clang-format /usr/local/bin/clang-format +ENV CLANG_FORMAT=clang-format diff --git a/tools/dockerfile/grpc_clang_format/Dockerfile b/tools/dockerfile/grpc_clang_format/Dockerfile index dff07feeb6d..b3abaef4657 100644 --- a/tools/dockerfile/grpc_clang_format/Dockerfile +++ b/tools/dockerfile/grpc_clang_format/Dockerfile @@ -14,11 +14,11 @@ FROM debian:jessie -RUN apt-get update && apt-get -y install wget -RUN echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list -RUN echo "deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list -RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - -RUN apt-get update && apt-get -y install clang-format-3.8 +RUN apt-get update && apt-get -y install wget xz-utils +RUN wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz +RUN tar xf clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz +RUN ln -s /clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/clang-format /usr/local/bin/clang-format +ENV CLANG_FORMAT=clang-format ADD clang_format_all_the_things.sh / CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"] diff --git a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh index 9bbb5d4dc1a..d36e9e57ea5 100755 --- a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh +++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.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" # clang format command -CLANG_FORMAT=clang-format-3.8 +CLANG_FORMAT=${CLANG_FORMAT:-clang-format-5.0} files= for dir in $DIRS do for glob in $GLOB 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 diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index 487ce15e2e7..da663d56869 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -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 ./bazel-0.4.4-installer-linux-x86_64.sh -RUN apt-get update && apt-get -y install wget -RUN echo "deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list -RUN echo "deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main" >> /etc/apt/sources.list -RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - -RUN apt-get update && apt-get -y install clang-format-3.8 +RUN apt-get update && apt-get -y install wget xz-utils +RUN wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz +RUN tar xf clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz +RUN ln -s /clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/clang-format /usr/local/bin/clang-format +ENV CLANG_FORMAT=clang-format # Prepare ccache RUN ln -s /usr/bin/ccache /usr/local/bin/gcc