Thomas Van Lenten | 1dcc329 | 2015-05-21 17:14:52 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Thomas Van Lenten | 79a23c4 | 2016-03-17 10:04:21 -0400 | [diff] [blame] | 3 | # Run this script to regenerate *.pbobjc.{h,m} for the well known types after |
| 4 | # the protocol compiler changes. |
Thomas Van Lenten | 1dcc329 | 2015-05-21 17:14:52 -0400 | [diff] [blame] | 5 | |
Thomas Van Lenten | 79a23c4 | 2016-03-17 10:04:21 -0400 | [diff] [blame] | 6 | # HINT: Flags passed to generate_well_known_types.sh will be passed directly |
Thomas Van Lenten | 1dcc329 | 2015-05-21 17:14:52 -0400 | [diff] [blame] | 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}/.." |
Thomas Van Lenten | 1dcc329 | 2015-05-21 17:14:52 -0400 | [diff] [blame] | 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 |
Thomas Van Lenten | 1dcc329 | 2015-05-21 17:14:52 -0400 | [diff] [blame] | 35 | make $@ protoc |
| 36 | |
Thomas Van Lenten | 4e43931 | 2015-07-06 12:29:08 -0400 | [diff] [blame] | 37 | declare -a RUNTIME_PROTO_FILES=( \ |
Thomas Van Lenten | 1dcc329 | 2015-05-21 17:14:52 -0400 | [diff] [blame] | 38 | google/protobuf/any.proto \ |
| 39 | google/protobuf/api.proto \ |
Thomas Van Lenten | 1dcc329 | 2015-05-21 17:14:52 -0400 | [diff] [blame] | 40 | google/protobuf/duration.proto \ |
| 41 | google/protobuf/empty.proto \ |
| 42 | google/protobuf/field_mask.proto \ |
| 43 | google/protobuf/source_context.proto \ |
| 44 | google/protobuf/struct.proto \ |
| 45 | google/protobuf/timestamp.proto \ |
| 46 | google/protobuf/type.proto \ |
| 47 | google/protobuf/wrappers.proto) |
| 48 | |
| 49 | ./protoc --objc_out="${ProtoRootDir}/objectivec" ${RUNTIME_PROTO_FILES[@]} |