]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/google.golang.org/appengine/internal/regen.sh
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / google.golang.org / appengine / internal / regen.sh
1 #!/bin/bash -e
2 #
3 # This script rebuilds the generated code for the protocol buffers.
4 # To run this you will need protoc and goprotobuf installed;
5 # see https://github.com/golang/protobuf for instructions.
6
7 PKG=google.golang.org/appengine
8
9 function die() {
10 echo 1>&2 $*
11 exit 1
12 }
13
14 # Sanity check that the right tools are accessible.
15 for tool in go protoc protoc-gen-go; do
16 q=$(which $tool) || die "didn't find $tool"
17 echo 1>&2 "$tool: $q"
18 done
19
20 echo -n 1>&2 "finding package dir... "
21 pkgdir=$(go list -f '{{.Dir}}' $PKG)
22 echo 1>&2 $pkgdir
23 base=$(echo $pkgdir | sed "s,/$PKG\$,,")
24 echo 1>&2 "base: $base"
25 cd $base
26
27 # Run protoc once per package.
28 for dir in $(find $PKG/internal -name '*.proto' | xargs dirname | sort | uniq); do
29 echo 1>&2 "* $dir"
30 protoc --go_out=. $dir/*.proto
31 done
32
33 for f in $(find $PKG/internal -name '*.pb.go'); do
34 # Remove proto.RegisterEnum calls.
35 # These cause duplicate registration panics when these packages
36 # are used on classic App Engine. proto.RegisterEnum only affects
37 # parsing the text format; we don't care about that.
38 # https://code.google.com/p/googleappengine/issues/detail?id=11670#c17
39 sed -i '/proto.RegisterEnum/d' $f
40 done