-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-proto.sh
executable file
·32 lines (27 loc) · 948 Bytes
/
build-proto.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
set -e
if ! [ -x "$(command -v protoc)" ]; then
echo "protoc is not installed"
exit 1
fi
if ! [ -x "$(command -v go)" ]; then
echo "go is not installed"
exit 1
fi
if ! [ -x "$(command -v protoc-gen-go)" ]; then
echo "protoc-gen-go is not installed"
exit 1
fi
proto_path="$PWD/proto/*"
for d in $proto_path; do
if [ -d "${d}" ]; then
echo "========================= compiling $d ======================="
echo "proto/$(basename "$d")/"
protoc --proto_path=proto --go_out=plugins=grpc:pb $(find proto/$(basename "$d")/ -iname "*.proto")
echo "========================= done compiling ======================="
else
echo "========================= compiling $d ======================="
protoc --proto_path=./proto --go_out=plugins=grpc:$PWD "proto/$(basename "$d")"
echo "========================= done compiling ======================="
fi
done