aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/codegen
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-01-19 22:07:51 -0800
committerGravatar David Garcia Quintas <dgq@google.com>2016-01-19 22:07:51 -0800
commit5220a75912fe0cb2ddfe3ee34dd8a7023382d705 (patch)
tree5491fa3fb642af4d48f854e8f13dda62bb5a8f25 /tools/codegen
parent278c0fbb619e57b2f6e1c45815c13bb43bef49d9 (diff)
have lb gen script use docker for clang formatting
Diffstat (limited to 'tools/codegen')
-rwxr-xr-xtools/codegen/core/gen_load_balancing_proto.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/codegen/core/gen_load_balancing_proto.sh b/tools/codegen/core/gen_load_balancing_proto.sh
index b0befc7e04..87c05f5fe8 100755
--- a/tools/codegen/core/gen_load_balancing_proto.sh
+++ b/tools/codegen/core/gen_load_balancing_proto.sh
@@ -70,8 +70,8 @@ read -r -d '' COPYRIGHT <<'EOF'
EOF
-apt-get update -qq
-apt-get install -y clang-format-3.6
+# build clang-format docker image
+docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format
CURRENT_YEAR=$(date +%Y)
COPYRIGHT_FILE=$(mktemp)
@@ -124,7 +124,15 @@ mv $TMPFILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.c"
cat $COPYRIGHT_FILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.h" > $TMPFILE
mv $TMPFILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.h"
-clang-format-3.6 -style="{BasedOnStyle: Google, Language: Cpp}" -i "$OUTPUT_DIR/$PROTO_BASENAME.pb.c"
-clang-format-3.6 -style="{BasedOnStyle: Google, Language: Cpp}" -i "$OUTPUT_DIR/$PROTO_BASENAME.pb.h"
+docker run --rm=true \
+ -v ${HOST_GIT_ROOT:-`pwd`}:/local-code \
+ -t grpc_clang_format \
+ clang-format-3.6 \
+ -style="{BasedOnStyle: Google, Language: Cpp}" \
+ -i "/local-code/src/core/proto/grpc/lb/v0/$PROTO_BASENAME.pb.c" && \
+ clang-format-3.6 \
+ -style="{BasedOnStyle: Google, Language: Cpp}" \
+ -i "/local-code/src/core/proto/grpc/lb/v0/$PROTO_BASENAME.pb.h"
+
popd > /dev/null