2015-12-30 21:19:09 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-10-31 05:14:48 +01:00
|
|
|
echo "Generating root gRPC server protos"
|
|
|
|
|
2020-05-06 16:43:56 +02:00
|
|
|
PROTOS="rpc.proto walletunlocker.proto **/*.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.
|
2020-05-06 16:43:56 +02: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 13:07:31 +02:00
|
|
|
--grpc-gateway_out=logtostderr=true,paths=source_relative,grpc_api_configuration=rest-annotations.yaml:. \
|
2020-05-06 16:43:56 +02:00
|
|
|
"${file}"
|
2018-10-31 05:14:48 +01:00
|
|
|
|
2020-05-28 13:07:31 +02:00
|
|
|
|
2020-05-06 16:43:56 +02:00
|
|
|
# Finally, generate the swagger file which describes the REST API in detail.
|
|
|
|
protoc -I/usr/local/include -I. \
|
2020-05-28 13:07:31 +02:00
|
|
|
--swagger_out=logtostderr=true,grpc_api_configuration=rest-annotations.yaml:. \
|
2020-05-06 16:43:56 +02:00
|
|
|
"${file}"
|
2018-10-31 05:14:48 +01:00
|
|
|
done
|