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.
7 PKG=google.golang.org/appengine
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"
20 echo -n 1>&2 "finding package dir... "
21 pkgdir=$(go list -f '{{.Dir}}' $PKG)
23 base=$(echo $pkgdir | sed "s,/$PKG\$,,")
24 echo 1>&2 "base: $base"
27 # Run protoc once per package.
28 for dir in $(find $PKG/internal -name '*.proto' | xargs dirname | sort | uniq); do
30 protoc --go_out=. $dir/*.proto
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