Browse Source

functional-tester/scripts/genproto: initial commit

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
3a8a150b0f
1 changed files with 28 additions and 0 deletions
  1. 28 0
      tools/functional-tester/scripts/genproto.sh

+ 28 - 0
tools/functional-tester/scripts/genproto.sh

@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+set -e
+
+if ! [[ "$0" =~ "scripts/genproto.sh" ]]; then
+  echo "must be run from repository root"
+  exit 255
+fi
+
+# for now, be conservative about what version of protoc we expect
+if ! [[ $(protoc --version) =~ "3.5.1" ]]; then
+  echo "could not find protoc 3.5.1, is it installed + in PATH?"
+  exit 255
+fi
+
+echo "Installing gogo/protobuf..."
+GOGOPROTO_ROOT="$GOPATH/src/github.com/gogo/protobuf"
+rm -rf $GOGOPROTO_ROOT
+go get -v github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto,protoc-gen-gofast}
+go get -v golang.org/x/tools/cmd/goimports
+pushd "${GOGOPROTO_ROOT}"
+  git reset --hard HEAD
+  make install
+popd
+
+printf "Generating agent\n"
+protoc --gofast_out=plugins=grpc:. \
+  --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. \
+  rpcpb/*.proto;