github.com/osrg/gobgp/v3@v3.30.0/tools/grpc/genproto.sh (about)

     1  #!/usr/bin/env bash
     2  # stolen from prometheus
     3  #
     4  # Generate all protobuf bindings.
     5  # Run from repository root.
     6  
     7  set -x
     8  set -e
     9  set -u
    10  
    11  if ! [[ "$0" =~ "tools/grpc/genproto.sh" ]]; then
    12  	echo "must be run from repository root"
    13  	exit 255
    14  fi
    15  
    16  if ! [[ $(protoc --version) =~ "3.19.1" ]]; then
    17  	echo "could not find protoc 3.19.1, is it installed + in PATH?"
    18  	exit 255
    19  fi
    20  
    21  echo "installing plugins"
    22  go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1
    23  go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0
    24  
    25  echo "generating code"
    26  protoc -I api -I /usr/local/include \
    27         --go_out=api --go_opt=paths=source_relative --go-grpc_out=api --go-grpc_opt=paths=source_relative api/*.proto