-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen-proto.sh
executable file
·37 lines (30 loc) · 1.04 KB
/
gen-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
33
34
35
36
37
#!/bin/bash
: ${GOPATH:?"ERROR: GOPATH not set"}
export PATH=$PATH:$GOPATH/bin
protoc_path=$(which protoc)
if [ ! -x "$protoc_path" ]; then
echo "ERROR: Protobuf Compiler not found"
exit 1
fi
protoc_gen_go_path=$(which protoc-gen-go)
if [ ! -x "$protoc_gen_go_path" ]; then
echo "ERROR: Protobuf Go bindings not found"
echo "go get -u github.com/golang/protobuf/{proto,protoc-gen-go}"
exit 1
fi
if [ ! -d "protobuf/schema" ]; then
echo "ERROR: Protobuf Schema not found"
exit 1
fi
protoc --proto_path=protobuf/schema \
-I$GOPATH/src \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--grpc-gateway_out=logtostderr=true:protobuf \
--swagger_out=logtostderr=true:protobuf \
--go_out=plugins=grpc:protobuf protobuf/schema/university/*.proto
protoc --proto_path=protobuf/schema \
-I$GOPATH/src \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--grpc-gateway_out=logtostderr=true:protobuf \
--swagger_out=logtostderr=true:protobuf \
--go_out=plugins=grpc:protobuf protobuf/schema/database/*.proto