genproto.sh 798 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. set -e
  3. if ! [[ "$0" =~ "scripts/genproto.sh" ]]; then
  4. echo "must be run from repository root"
  5. exit 255
  6. fi
  7. # for now, be conservative about what version of protoc we expect
  8. if ! [[ $(protoc --version) =~ "3.7.1" ]]; then
  9. echo "could not find protoc 3.7.1, is it installed + in PATH?"
  10. exit 255
  11. fi
  12. echo "Installing gogo/protobuf..."
  13. GOGOPROTO_ROOT="$GOPATH/src/github.com/gogo/protobuf"
  14. rm -rf $GOGOPROTO_ROOT
  15. go get -v github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto,protoc-gen-gofast}
  16. go get -v golang.org/x/tools/cmd/goimports
  17. pushd "${GOGOPROTO_ROOT}"
  18. git reset --hard HEAD
  19. make install
  20. popd
  21. printf "Generating agent\n"
  22. protoc --gofast_out=plugins=grpc:. \
  23. --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. \
  24. rpcpb/*.proto;