generate_descriptors_proto.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. readonly ProtoC="${ProtoRootDir}/src/protoc"
  11. pushd "${ProtoRootDir}" > /dev/null
  12. if test ! -e src/google/protobuf/stubs/common.h; then
  13. cat >&2 << __EOF__
  14. Could not find source code. Make sure you are running this script from the
  15. root of the distribution tree.
  16. __EOF__
  17. exit 1
  18. fi
  19. if test ! -e src/Makefile; then
  20. cat >&2 << __EOF__
  21. Could not find src/Makefile. You must run ./configure (and perhaps
  22. ./autogen.sh) first.
  23. __EOF__
  24. exit 1
  25. fi
  26. # Make sure the compiler is current.
  27. cd src
  28. make $@ google/protobuf/stubs/pbconfig.h
  29. make $@ protoc
  30. declare -a RUNTIME_PROTO_FILES=(\
  31. google/protobuf/any.proto \
  32. google/protobuf/api.proto \
  33. google/protobuf/descriptor.proto \
  34. google/protobuf/duration.proto \
  35. google/protobuf/empty.proto \
  36. google/protobuf/field_mask.proto \
  37. google/protobuf/source_context.proto \
  38. google/protobuf/struct.proto \
  39. google/protobuf/timestamp.proto \
  40. google/protobuf/type.proto \
  41. google/protobuf/wrappers.proto)
  42. ./protoc --objc_out="${ProtoRootDir}/objectivec" ${RUNTIME_PROTO_FILES[@]}
  43. popd > /dev/null