Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4427)

Unified Diff: chrome/browser/sync/protocol/proto2_to_oproto.py

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/protocol/proto2_to_oproto.py
===================================================================
--- chrome/browser/sync/protocol/proto2_to_oproto.py (revision 0)
+++ chrome/browser/sync/protocol/proto2_to_oproto.py (revision 0)
@@ -0,0 +1,30 @@
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+""" Strip a .proto of options not supported by open-source protobuf tools. """
+
+import re
+import sys
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ print "Usage: %s input_file output_file " % sys.argv[0]
+ sys.exit(1)
+
+ input_file = sys.argv[1]
+ output_file = sys.argv[2]
+
+ protobuf = open(input_file).read()
+
+ # Comment out lines like "option java_api_version = 1;"
+ protobuf = re.sub("(option .*api_version.*\=.*)", r"// \1", protobuf)
+
+ # Comment out lines like "option java_java5_enums = false;"
+ protobuf = re.sub("(option .*java_java5_enums.*\=.*)", r"// \1", protobuf)
+
+ # Comment out the java package.
+ protobuf = re.sub("(option .*java_package.*\=.*)", r"// \1", protobuf)
+
+ open(output_file, "w").write(protobuf)
+
Property changes on: chrome\browser\sync\protocol\proto2_to_oproto.py
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698