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