aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/DevTools/generate_descriptors_proto.sh
diff options
context:
space:
mode:
Diffstat (limited to 'objectivec/DevTools/generate_descriptors_proto.sh')
-rwxr-xr-xobjectivec/DevTools/generate_descriptors_proto.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/objectivec/DevTools/generate_descriptors_proto.sh b/objectivec/DevTools/generate_descriptors_proto.sh
new file mode 100755
index 00000000..42502bfe
--- /dev/null
+++ b/objectivec/DevTools/generate_descriptors_proto.sh
@@ -0,0 +1,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