generate_descriptors_proto.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. # Run this script to regenerate descriptor.pbobjc.{h,m} after the protocol
  3. # compiler changes.
  4. # HINT: Flags passed to generate_descriptor_proto.sh will be passed directly
  5. # to make when building protoc. This is particularly useful for passing
  6. # -j4 to run 4 jobs simultaneously.
  7. set -eu
  8. readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
  9. readonly ProtoRootDir="${ScriptDir}/.."
  10. pushd "${ProtoRootDir}" > /dev/null
  11. if test ! -e src/google/protobuf/stubs/common.h; then
  12. cat >&2 << __EOF__
  13. Could not find source code. Make sure you are running this script from the
  14. root of the distribution tree.
  15. __EOF__
  16. exit 1
  17. fi
  18. if test ! -e src/Makefile; then
  19. cat >&2 << __EOF__
  20. Could not find src/Makefile. You must run ./configure (and perhaps
  21. ./autogen.sh) first.
  22. __EOF__
  23. exit 1
  24. fi
  25. # Make sure the compiler is current.
  26. cd src
  27. make $@ protoc
  28. declare -a RUNTIME_PROTO_FILES=( \
  29. google/protobuf/any.proto \
  30. google/protobuf/api.proto \
  31. google/protobuf/descriptor.proto \
  32. google/protobuf/duration.proto \
  33. google/protobuf/empty.proto \
  34. google/protobuf/field_mask.proto \
  35. google/protobuf/source_context.proto \
  36. google/protobuf/struct.proto \
  37. google/protobuf/timestamp.proto \
  38. google/protobuf/type.proto \
  39. google/protobuf/wrappers.proto)
  40. ./protoc --objc_out="${ProtoRootDir}/objectivec" ${RUNTIME_PROTO_FILES[@]}