本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2KB

  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. PKG=google.golang.org/appengine
  7. function die() {
  8. echo 1>&2 $*
  9. exit 1
  10. }
  11. # Sanity check that the right tools are accessible.
  12. for tool in go protoc protoc-gen-go; do
  13. q=$(which $tool) || die "didn't find $tool"
  14. echo 1>&2 "$tool: $q"
  15. done
  16. echo -n 1>&2 "finding package dir... "
  17. pkgdir=$(go list -f '{{.Dir}}' $PKG)
  18. echo 1>&2 $pkgdir
  19. base=$(echo $pkgdir | sed "s,/$PKG\$,,")
  20. echo 1>&2 "base: $base"
  21. cd $base
  22. # Run protoc once per package.
  23. for dir in $(find $PKG/internal -name '*.proto' | xargs dirname | sort | uniq); do
  24. echo 1>&2 "* $dir"
  25. protoc --go_out=. $dir/*.proto
  26. done
  27. for f in $(find $PKG/internal -name '*.pb.go'); do
  28. # Remove proto.RegisterEnum calls.
  29. # These cause duplicate registration panics when these packages
  30. # are used on classic App Engine. proto.RegisterEnum only affects
  31. # parsing the text format; we don't care about that.
  32. # https://code.google.com/p/googleappengine/issues/detail?id=11670#c17
  33. sed -i '/proto.RegisterEnum/d' $f
  34. done
上海开阖软件有限公司 沪ICP备12045867号-1