2015-12-30 21:19:09 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-10-31 05:14:48 +01:00
|
|
|
echo "Generating root gRPC server protos"
|
|
|
|
|
2016-10-15 23:38:47 +02:00
|
|
|
# Generate the protos.
|
|
|
|
protoc -I/usr/local/include -I. \
|
|
|
|
-I$GOPATH/src \
|
|
|
|
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
2017-03-27 20:01:02 +02:00
|
|
|
--go_out=plugins=grpc:. \
|
2016-10-15 23:38:47 +02:00
|
|
|
rpc.proto
|
|
|
|
|
2018-02-07 04:11:11 +01:00
|
|
|
# Generate the REST reverse proxy.
|
2016-10-15 23:38:47 +02:00
|
|
|
protoc -I/usr/local/include -I. \
|
|
|
|
-I$GOPATH/src \
|
|
|
|
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
|
|
|
--grpc-gateway_out=logtostderr=true:. \
|
|
|
|
rpc.proto
|
|
|
|
|
|
|
|
# Finally, generate the swagger file which describes the REST API in detail.
|
|
|
|
protoc -I/usr/local/include -I. \
|
|
|
|
-I$GOPATH/src \
|
|
|
|
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
|
|
|
--swagger_out=logtostderr=true:. \
|
|
|
|
rpc.proto
|
2018-10-31 05:14:48 +01:00
|
|
|
|
|
|
|
# For each of the sub-servers, we then generate their protos, but a restricted
|
|
|
|
# set as they don't yet require REST proxies, or swagger docs.
|
|
|
|
for file in **/*.proto
|
|
|
|
do
|
|
|
|
DIRECTORY=$(dirname ${file})
|
|
|
|
echo "Generating protos from ${file}, into ${DIRECTORY}"
|
|
|
|
|
|
|
|
protoc -I/usr/local/include -I. \
|
|
|
|
-I$GOPATH/src \
|
|
|
|
--go_out=plugins=grpc:. \
|
|
|
|
${file}
|
|
|
|
done
|