Bug 1385461 - Add script to regenerate all .pb.cc and .pb.h files. draft
authorFrancois Marier <francois@mozilla.com>
Thu, 12 Oct 2017 16:25:33 -0700
changeset 683518 bd27f439c2ad29d2d1a985b23520223c4c614f1e
parent 683517 1bf0d6e1ce4ca7ac1b91612eb5a1edb6aeb3f0dd
child 683519 51f34cd1388263ca63149f1cc5787aa1d1200411
push id85402
push userfmarier@mozilla.com
push dateThu, 19 Oct 2017 21:21:03 +0000
bugs1385461
milestone58.0a1
Bug 1385461 - Add script to regenerate all .pb.cc and .pb.h files. MozReview-Commit-ID: LR0knKFfL7
toolkit/components/protobuf/README.txt
toolkit/components/protobuf/regenerate_cpp_files.sh
--- 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