2021-12-13 11:56:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# generate compiles the *.pb.go stubs from the *.proto files.
|
|
|
|
function generate() {
|
|
|
|
# Generate the gRPC bindings for all proto files.
|
|
|
|
for file in ./*.proto
|
|
|
|
do
|
|
|
|
protoc -I/usr/local/include -I. -I.. \
|
|
|
|
--go_out . --go_opt paths=source_relative \
|
2022-05-04 20:25:40 +00:00
|
|
|
--go-grpc_out . --go-grpc_opt paths=source_relative \
|
2021-12-13 11:56:40 +00:00
|
|
|
"${file}"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# format formats the *.proto files with the clang-format utility.
|
|
|
|
function format() {
|
|
|
|
find . -name "*.proto" -print0 | xargs -0 clang-format --style=file -i
|
|
|
|
}
|
|
|
|
|
|
|
|
# Compile and format the swapserverrpc package.
|
|
|
|
pushd swapserverrpc
|
|
|
|
format
|
|
|
|
generate
|
|
|
|
popd
|