2015-12-30 23:19:09 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-10-31 07:14:48 +03:00
|
|
|
echo "Generating root gRPC server protos"
|
|
|
|
|
2016-10-16 00:38:47 +03:00
|
|
|
# Generate the protos.
|
|
|
|
protoc -I/usr/local/include -I. \
|
|
|
|
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
2018-12-11 13:42:43 +03:00
|
|
|
--go_out=plugins=grpc,paths=source_relative:. \
|
2016-10-16 00:38:47 +03:00
|
|
|
rpc.proto
|
|
|
|
|
2018-02-07 06:11:11 +03:00
|
|
|
# Generate the REST reverse proxy.
|
2016-10-16 00:38:47 +03:00
|
|
|
protoc -I/usr/local/include -I. \
|
|
|
|
-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/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
|
|
|
--swagger_out=logtostderr=true:. \
|
|
|
|
rpc.proto
|
2018-10-31 07:14:48 +03: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}"
|
|
|
|
|
2019-02-02 05:01:44 +03:00
|
|
|
protoc -I/usr/local/include -I. \
|
2018-12-20 17:25:04 +03:00
|
|
|
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
2018-12-11 13:42:43 +03:00
|
|
|
--go_out=plugins=grpc,paths=source_relative:. \
|
2018-10-31 07:14:48 +03:00
|
|
|
${file}
|
|
|
|
done
|