blob: 84ba07380f3154778464a71570de8e611257f5cf [file] [log] [blame]
Brian Silverman9c614bc2016-02-15 20:20:02 -05001#!/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
10set -eu
11
12readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
13readonly ProtoRootDir="${ScriptDir}/.."
14
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
35make $@ protoc
36
37declare -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[@]}