aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/dockerfile/grpc_clang_format
diff options
context:
space:
mode:
Diffstat (limited to 'tools/dockerfile/grpc_clang_format')
-rw-r--r--tools/dockerfile/grpc_clang_format/Dockerfile6
-rwxr-xr-xtools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh30
2 files changed, 36 insertions, 0 deletions
diff --git a/tools/dockerfile/grpc_clang_format/Dockerfile b/tools/dockerfile/grpc_clang_format/Dockerfile
new file mode 100644
index 0000000000..a0fff2f2b5
--- /dev/null
+++ b/tools/dockerfile/grpc_clang_format/Dockerfile
@@ -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'"]
+
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
new file mode 100755
index 0000000000..5aa265800d
--- /dev/null
+++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.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
+