regenerate.bash 790 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. # Copyright 2018 The Go Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style
  4. # license that can be found in the LICENSE file.
  5. set -e
  6. # Install the working tree's protoc-gen-gen in a tempdir.
  7. tmpdir=$(mktemp -d -t protobuf-regen.XXXXXX)
  8. trap 'rm -rf $tmpdir' EXIT
  9. mkdir -p $tmpdir/bin
  10. PATH=$tmpdir/bin:$PATH
  11. GOBIN=$tmpdir/bin go install ./cmd/protoc-gen-go
  12. GOBIN=$tmpdir/bin go install ./cmd/protoc-gen-go-grpc
  13. # Generate various test protos.
  14. PROTO_DIRS=(
  15. cmd/protoc-gen-go/testdata
  16. cmd/protoc-gen-go-grpc/testdata
  17. )
  18. for dir in ${PROTO_DIRS[@]}; do
  19. for p in `find $dir -name "*.proto"`; do
  20. echo "# $p"
  21. protoc -I$dir \
  22. --go_out=paths=source_relative:$dir \
  23. --go-grpc_out=paths=source_relative:$dir \
  24. $p
  25. done
  26. done