mirror of https://github.com/grpc/grpc.git
commit
0f9a118f4e
16 changed files with 71 additions and 21 deletions
@ -0,0 +1,13 @@ |
||||
#!/bin/bash |
||||
|
||||
set -ex |
||||
|
||||
# change to root directory |
||||
cd $(dirname $0)/../.. |
||||
|
||||
# build clang-format docker image |
||||
docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format |
||||
|
||||
# run clang-format against the checked out codebase |
||||
docker run -e TEST=$TEST --rm=true -v `pwd`:/local-code -t grpc_clang_format /clang_format_all_the_things.sh |
||||
|
@ -0,0 +1,6 @@ |
||||
FROM ubuntu:vivid |
||||
RUN apt-get update |
||||
RUN apt-get -y install clang-format-3.6 |
||||
ADD clang_format_all_the_things.sh / |
||||
CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"] |
||||
|
@ -0,0 +1,30 @@ |
||||
#!/bin/bash |
||||
|
||||
# directories to run against |
||||
DIRS="src/core src/cpp test/core test/cpp include" |
||||
|
||||
# file matching patterns to check |
||||
GLOB="*.h *.cpp" |
||||
|
||||
# clang format command |
||||
CLANG_FORMAT=clang-format-3.6 |
||||
|
||||
files= |
||||
for dir in $DIRS |
||||
do |
||||
for glob in $GLOB |
||||
do |
||||
files="$files `find /local-code/$dir -name $glob`" |
||||
done |
||||
done |
||||
|
||||
if [ "x$TEST" = "x" ] |
||||
then |
||||
echo $files | xargs $CLANG_FORMAT -i |
||||
else |
||||
for file in $files |
||||
do |
||||
$CLANG_FORMAT $file | diff $file - |
||||
done |
||||
fi |
||||
|
Loading…
Reference in new issue