aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/DevTools/generate_descriptors_proto.sh
blob: 42502bfec5d436e601d21c20a58e5f59155514b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

# This script will generate the common descriptors needed by the Objective C
# runtime.

# HINT:  Flags passed to generate_descriptor_proto.sh will be passed directly
#   to make when building protoc.  This is particularly useful for passing
#   -j4 to run 4 jobs simultaneously.

set -eu

readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
readonly ProtoRootDir="${ScriptDir}/../.."
readonly ProtoC="${ProtoRootDir}/src/protoc"

pushd "${ProtoRootDir}" > /dev/null

# Compiler build fails if config.h hasn't been made yet (even if configure/etc.
# have been run, so get that made first).
make $@ config.h

# Make sure the compiler is current.
cd src
make $@ protoc

# These really should only be run when the inputs or compiler are newer than
# the outputs.

# Needed by the runtime.
./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/descriptor.proto

# Well known types that the library provides helpers for.
./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/timestamp.proto
./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/duration.proto

popd > /dev/null