2018-08-22 20:46:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright 2018 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Install the working tree's protoc-gen-gen in a tempdir.
|
|
|
|
tmpdir=$(mktemp -d -t protobuf-regen.XXXXXX)
|
|
|
|
trap 'rm -rf $tmpdir' EXIT
|
|
|
|
mkdir -p $tmpdir/bin
|
|
|
|
PATH=$tmpdir/bin:$PATH
|
|
|
|
GOBIN=$tmpdir/bin go install ./cmd/protoc-gen-go
|
2018-09-21 22:03:34 +00:00
|
|
|
GOBIN=$tmpdir/bin go install ./cmd/protoc-gen-go-grpc
|
2018-08-22 20:46:02 +00:00
|
|
|
|
|
|
|
# Generate various test protos.
|
|
|
|
PROTO_DIRS=(
|
|
|
|
cmd/protoc-gen-go/testdata
|
2018-09-21 22:03:34 +00:00
|
|
|
cmd/protoc-gen-go-grpc/testdata
|
2018-08-22 20:46:02 +00:00
|
|
|
)
|
|
|
|
for dir in ${PROTO_DIRS[@]}; do
|
|
|
|
for p in `find $dir -name "*.proto"`; do
|
|
|
|
echo "# $p"
|
2018-09-21 22:03:34 +00:00
|
|
|
protoc -I$dir \
|
|
|
|
--go_out=paths=source_relative:$dir \
|
|
|
|
--go-grpc_out=paths=source_relative:$dir \
|
|
|
|
$p
|
2018-08-22 20:46:02 +00:00
|
|
|
done
|
|
|
|
done
|