2015-12-30 23:19:09 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-10-31 07:14:48 +03:00
|
|
|
echo "Generating root gRPC server protos"
|
|
|
|
|
2020-05-06 17:43:56 +03:00
|
|
|
PROTOS="rpc.proto walletunlocker.proto **/*.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.
|
2020-05-06 17:43:56 +03:00
|
|
|
for file in $PROTOS; do
|
|
|
|
DIRECTORY=$(dirname "${file}")
|
|
|
|
echo "Generating protos from ${file}, into ${DIRECTORY}"
|
|
|
|
|
|
|
|
# Generate the protos.
|
|
|
|
protoc -I/usr/local/include -I. \
|
|
|
|
--go_out=plugins=grpc,paths=source_relative:. \
|
|
|
|
"${file}"
|
|
|
|
|
|
|
|
# Generate the REST reverse proxy.
|
|
|
|
protoc -I/usr/local/include -I. \
|
2020-05-28 14:07:31 +03:00
|
|
|
--grpc-gateway_out=logtostderr=true,paths=source_relative,grpc_api_configuration=rest-annotations.yaml:. \
|
2020-05-06 17:43:56 +03:00
|
|
|
"${file}"
|
2018-10-31 07:14:48 +03:00
|
|
|
|
2020-05-28 14:07:31 +03:00
|
|
|
|
2020-05-06 17:43:56 +03:00
|
|
|
# Finally, generate the swagger file which describes the REST API in detail.
|
|
|
|
protoc -I/usr/local/include -I. \
|
2020-05-28 14:07:31 +03:00
|
|
|
--swagger_out=logtostderr=true,grpc_api_configuration=rest-annotations.yaml:. \
|
2020-05-06 17:43:56 +03:00
|
|
|
"${file}"
|
2018-10-31 07:14:48 +03:00
|
|
|
done
|