blob: be9b38a55d61f6fe53a5ac58091a1f0a6868fa9b [file] [log] [blame]
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -04001#!/bin/bash
2
Thomas Van Lenten79a23c42016-03-17 10:04:21 -04003# Run this script to regenerate *.pbobjc.{h,m} for the well known types after
4# the protocol compiler changes.
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -04005
Thomas Van Lenten79a23c42016-03-17 10:04:21 -04006# HINT: Flags passed to generate_well_known_types.sh will be passed directly
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -04007# to make when building protoc. This is particularly useful for passing
8# -j4 to run 4 jobs simultaneously.
9
10set -eu
11
12readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
13readonly ProtoRootDir="${ScriptDir}/.."
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040014
15pushd "${ProtoRootDir}" > /dev/null
16
17if test ! -e src/google/protobuf/stubs/common.h; then
18 cat >&2 << __EOF__
19Could not find source code. Make sure you are running this script from the
20root of the distribution tree.
21__EOF__
22 exit 1
23fi
24
25if test ! -e src/Makefile; then
26 cat >&2 << __EOF__
27Could not find src/Makefile. You must run ./configure (and perhaps
28./autogen.sh) first.
29__EOF__
30 exit 1
31fi
32
33# Make sure the compiler is current.
34cd src
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040035make $@ protoc
36
Thomas Van Lenten4e439312015-07-06 12:29:08 -040037declare -a RUNTIME_PROTO_FILES=( \
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040038 google/protobuf/any.proto \
39 google/protobuf/api.proto \
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040040 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[@]}