Bug 1385461 - Add script to regenerate all .pb.cc and .pb.h files.
MozReview-Commit-ID: LR0knKFfL7
--- a/toolkit/components/protobuf/README.txt
+++ b/toolkit/components/protobuf/README.txt
@@ -18,8 +18,10 @@ We do not include the protobuf tests or
# Upgrading the Protobuf Library
1. Get a new protobuf release from https://github.com/google/protobuf/releases
2. Run `$ ./toolkit/components/protobuf/upgrade_protobuf.sh ~/path/to/release/checkout/of/protobuf`.
3. Update the moz.build to export the new set of headers and add any new .cc
files to the unified sources and remove old ones.
+
+4. Re-generate all .pb.cc and .pb.h files using `$ ./toolkit/components/protobuf/regenerate_cpp_files.sh`.
new file mode 100755
--- /dev/null
+++ b/toolkit/components/protobuf/regenerate_cpp_files.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+
+if which protoc >/dev/null ; then
+ echo "Using $(which protoc) to regenerate .pb.cc and .pb.h files."
+else
+ echo "protoc not found in your path. Cannot regenerate the .pb.cc and .pb.h files."
+ exit 1
+fi
+
+regenerate() {
+ DIR="$1"
+ PROTO="$2"
+ echo
+ echo "${DIR}${PROTO}:"
+ pushd "$DIR" >/dev/null
+ protoc --cpp_out=. "$PROTO"
+ popd >/dev/null
+}
+
+cd $(dirname $0)
+cd ../../.. # Top level.
+
+regenerate gfx/layers/protobuf/ LayerScopePacket.proto
+regenerate devtools/shared/heapsnapshot/ CoreDump.proto
+regenerate toolkit/components/downloads/chromium/chrome/common/safe_browsing/ csd.proto
+regenerate toolkit/components/url-classifier/chromium/ safebrowsing.proto