summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/sync/protocol/proto2_to_oproto.py30
-rw-r--r--chrome/browser/sync/protocol/sync.proto5
-rwxr-xr-xchrome/chrome.gyp42
-rw-r--r--third_party/protobuf2/protobuf.gyp124
4 files changed, 109 insertions, 92 deletions
diff --git a/chrome/browser/sync/protocol/proto2_to_oproto.py b/chrome/browser/sync/protocol/proto2_to_oproto.py
new file mode 100644
index 0000000..eb14ab9
--- /dev/null
+++ b/chrome/browser/sync/protocol/proto2_to_oproto.py
@@ -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)
+
diff --git a/chrome/browser/sync/protocol/sync.proto b/chrome/browser/sync/protocol/sync.proto
index 64fcaa9..0381b329 100644
--- a/chrome/browser/sync/protocol/sync.proto
+++ b/chrome/browser/sync/protocol/sync.proto
@@ -6,7 +6,10 @@
syntax = "proto2";
-option optimize_for = LITE_RUNTIME;
+option java_api_version = 1;
+option cc_api_version = 1;
+option py_api_version = 1;
+option java_java5_enums = false;
package sync_pb;
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 8214db3..203da40 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -2754,10 +2754,10 @@
}],
['chromeos==1',{
'dependencies': [
- '../third_party/protobuf2/protobuf.gyp:protobuf',
- '../third_party/protobuf2/protobuf.gyp:protoc',
- '../third_party/cros/cros_api.gyp:cros_api',
- ],
+ '../third_party/protobuf2/protobuf.gyp:protobuf',
+ '../third_party/protobuf2/protobuf.gyp:protoc',
+ '../third_party/cros/cros_api.gyp:cros_api',
+ ],
'actions': [
{
'action_name': 'my_proto',
@@ -4699,11 +4699,11 @@
'../net/net.gyp:net',
'../third_party/icu/icu.gyp:icuuc',
'../third_party/libjingle/libjingle.gyp:libjingle',
+ '../third_party/protobuf2/protobuf.gyp:protobuf',
'../third_party/sqlite/sqlite.gyp:sqlite',
'common',
'notifier',
'sync',
- 'sync_proto',
],
'conditions': [
['OS=="win"', {
@@ -6438,10 +6438,27 @@
'type': 'none',
'actions': [
{
+ # TODO(chron): Remove this preprocessing step.
+ 'action_name': 'preprocessing sync.proto',
+ 'inputs': [
+ 'browser/sync/protocol/proto2_to_oproto.py',
+ 'browser/sync/protocol/sync.proto',
+ ],
+ 'outputs': [
+ '<(protoc_out_dir)/chrome/browser/sync/protocol/sync.proto',
+ ],
+ 'action': [
+ 'python',
+ 'browser/sync/protocol/proto2_to_oproto.py',
+ 'browser/sync/protocol/sync.proto',
+ '<(protoc_out_dir)/chrome/browser/sync/protocol/sync.proto',
+ ],
+ },
+ {
'action_name': 'compiling sync.proto',
'inputs': [
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
- 'browser/sync/protocol/sync.proto',
+ '<(protoc_out_dir)/chrome/browser/sync/protocol/sync.proto',
],
'outputs': [
'<(protoc_out_dir)/chrome/browser/sync/protocol/sync.pb.cc',
@@ -6449,19 +6466,16 @@
],
'action': [
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
- '--proto_path=browser/sync/protocol',
- 'browser/sync/protocol/sync.proto',
+ '--proto_path=<(protoc_out_dir)/chrome/browser/sync/protocol',
+ '<(protoc_out_dir)/chrome/browser/sync/protocol/sync.proto',
'--cpp_out=<(protoc_out_dir)/chrome/browser/sync/protocol',
],
},
],
'dependencies': [
- '../third_party/protobuf2/protobuf.gyp:protobuf_lite',
+ '../third_party/protobuf2/protobuf.gyp:protobuf',
'../third_party/protobuf2/protobuf.gyp:protoc',
],
- 'export_dependent_settings': [
- '../third_party/protobuf2/protobuf.gyp:protobuf_lite',
- ],
},
{
'target_name': 'notifier',
@@ -6551,6 +6565,7 @@
'dependencies': [
'../third_party/expat/expat.gyp:expat',
'../third_party/libjingle/libjingle.gyp:libjingle',
+ '../third_party/protobuf2/protobuf.gyp:protobuf',
'sync_proto',
],
'conditions': [
@@ -6611,10 +6626,10 @@
'dependencies': [
'../testing/gtest.gyp:gtest',
'../third_party/libjingle/libjingle.gyp:libjingle',
+ '../third_party/protobuf2/protobuf.gyp:protobuf',
'../third_party/tcmalloc/tcmalloc.gyp:tcmalloc',
'notifier',
'sync',
- 'sync_proto',
'test_support_unit',
],
'conditions': [
@@ -6779,6 +6794,7 @@
],
'dependencies': [
'../third_party/libjingle/libjingle.gyp:libjingle',
+ '../third_party/protobuf2/protobuf.gyp:protobuf',
'sync_proto',
],
'conditions': [
diff --git a/third_party/protobuf2/protobuf.gyp b/third_party/protobuf2/protobuf.gyp
index 907bd28..b6fe48a 100644
--- a/third_party/protobuf2/protobuf.gyp
+++ b/third_party/protobuf2/protobuf.gyp
@@ -14,106 +14,45 @@
'config_h_dir':
'src/vsprojects', # crafted for msvc.
},
- 'target_defaults': {
- 'msvs_disabled_warnings': [
- 4018, # signed/unsigned mismatch in comparison
- 4244, # implicit conversion, possible loss of data
- 4355, # 'this' used in base member initializer list
- ],
- 'defines!': [
- 'WIN32_LEAN_AND_MEAN', # Protobuf defines this itself.
- ],
- },
}]
],
'targets': [
- # The "lite" lib is about 1/7th the size of the heavy lib,
- # but it doesn't support some of the more exotic features of
- # protobufs, like reflection. To generate C++ code that can link
- # against the lite version of the library, add the option line:
- #
- # option optimize_for = LITE_RUNTIME;
- #
- # to your .proto file.
- {
- 'target_name': 'protobuf_lite',
+ { 'target_name': 'protobuf',
'type': '<(library)',
'sources': [
'src/src/google/protobuf/stubs/common.h',
'src/src/google/protobuf/stubs/once.h',
- 'src/src/google/protobuf/extension_set.h',
- 'src/src/google/protobuf/generated_message_util.h',
- 'src/src/google/protobuf/message_lite.h',
- 'src/src/google/protobuf/repeated_field.h',
- 'src/src/google/protobuf/wire_format_lite.h',
- 'src/src/google/protobuf/wire_format_lite_inl.h',
- 'src/src/google/protobuf/io/coded_stream.h',
- 'src/src/google/protobuf/io/zero_copy_stream.h',
- 'src/src/google/protobuf/io/zero_copy_stream_impl_lite.h',
-
- 'src/src/google/protobuf/stubs/common.cc',
- 'src/src/google/protobuf/stubs/once.cc',
- 'src/src/google/protobuf/stubs/hash.cc',
- 'src/src/google/protobuf/stubs/hash.h',
- 'src/src/google/protobuf/stubs/map-util.h',
- 'src/src/google/protobuf/stubs/stl_util-inl.h',
- 'src/src/google/protobuf/extension_set.cc',
- 'src/src/google/protobuf/generated_message_util.cc',
- 'src/src/google/protobuf/message_lite.cc',
- 'src/src/google/protobuf/repeated_field.cc',
- 'src/src/google/protobuf/wire_format_lite.cc',
- 'src/src/google/protobuf/io/coded_stream.cc',
- 'src/src/google/protobuf/io/zero_copy_stream.cc',
- 'src/src/google/protobuf/io/zero_copy_stream_impl_lite.cc',
- '<(config_h_dir)/config.h',
- ],
- 'include_dirs': [
- '<(config_h_dir)',
- 'src/src',
- ],
- # This macro must be defined to suppress the use of dynamic_cast<>,
- # which requires RTTI.
- 'defines': [
- 'GOOGLE_PROTOBUF_NO_RTTI',
- ],
- 'direct_dependent_settings': {
- 'include_dirs': [
- '<(config_h_dir)',
- 'src/src',
- ],
- 'defines': [
- 'GOOGLE_PROTOBUF_NO_RTTI',
- ],
- },
- },
- # This is the full, heavy protobuf lib that's needed for c++ .proto's
- # that don't specify the LITE_RUNTIME option. The protocol
- # compiler itself (protoc) falls into that category.
- {
- 'target_name': 'protobuf',
- 'type': '<(library)',
- 'sources': [
'src/src/google/protobuf/descriptor.h',
'src/src/google/protobuf/descriptor.pb.h',
'src/src/google/protobuf/descriptor_database.h',
'src/src/google/protobuf/dynamic_message.h',
+ 'src/src/google/protobuf/extension_set.h',
'src/src/google/protobuf/generated_message_reflection.h',
'src/src/google/protobuf/message.h',
'src/src/google/protobuf/reflection_ops.h',
+ 'src/src/google/protobuf/repeated_field.h',
'src/src/google/protobuf/service.h',
'src/src/google/protobuf/text_format.h',
'src/src/google/protobuf/unknown_field_set.h',
'src/src/google/protobuf/wire_format.h',
'src/src/google/protobuf/wire_format_inl.h',
+ 'src/src/google/protobuf/io/coded_stream.h',
'src/src/google/protobuf/io/gzip_stream.h',
'src/src/google/protobuf/io/printer.h',
'src/src/google/protobuf/io/tokenizer.h',
+ 'src/src/google/protobuf/io/zero_copy_stream.h',
'src/src/google/protobuf/io/zero_copy_stream_impl.h',
'src/src/google/protobuf/compiler/code_generator.h',
'src/src/google/protobuf/compiler/command_line_interface.h',
'src/src/google/protobuf/compiler/importer.h',
'src/src/google/protobuf/compiler/parser.h',
+ 'src/src/google/protobuf/stubs/common.cc',
+ 'src/src/google/protobuf/stubs/once.cc',
+ 'src/src/google/protobuf/stubs/hash.cc',
+ 'src/src/google/protobuf/stubs/hash.h',
+ 'src/src/google/protobuf/stubs/map-util.h',
+ 'src/src/google/protobuf/stubs/stl_util-inl.h',
'src/src/google/protobuf/stubs/substitute.cc',
'src/src/google/protobuf/stubs/substitute.h',
'src/src/google/protobuf/stubs/strutil.cc',
@@ -123,31 +62,60 @@
'src/src/google/protobuf/descriptor.pb.cc',
'src/src/google/protobuf/descriptor_database.cc',
'src/src/google/protobuf/dynamic_message.cc',
+ 'src/src/google/protobuf/extension_set.cc',
'src/src/google/protobuf/extension_set_heavy.cc',
'src/src/google/protobuf/generated_message_reflection.cc',
'src/src/google/protobuf/message.cc',
+ 'src/src/google/protobuf/message_lite.cc',
'src/src/google/protobuf/reflection_ops.cc',
+ 'src/src/google/protobuf/repeated_field.cc',
'src/src/google/protobuf/service.cc',
'src/src/google/protobuf/text_format.cc',
'src/src/google/protobuf/unknown_field_set.cc',
'src/src/google/protobuf/wire_format.cc',
+ 'src/src/google/protobuf/wire_format_lite.cc',
+ 'src/src/google/protobuf/io/coded_stream.cc',
'src/src/google/protobuf/io/gzip_stream.cc',
'src/src/google/protobuf/io/printer.cc',
'src/src/google/protobuf/io/tokenizer.cc',
+ 'src/src/google/protobuf/io/zero_copy_stream.cc',
'src/src/google/protobuf/io/zero_copy_stream_impl.cc',
'src/src/google/protobuf/io/zero_copy_stream_impl_lite.cc',
'src/src/google/protobuf/compiler/importer.cc',
'src/src/google/protobuf/compiler/parser.cc',
+ '<(config_h_dir)/config.h',
],
- 'dependencies': [
- 'protobuf_lite',
+
+ 'conditions': [
+ ['OS != "win"', {
+ # src/src/google/protobuf/generated_message_reflection.h can figure
+ # out whether RTTI is enabled or disabled via compiler-defined macros
+ # when building with MSVC. For other compilers, this macro must be
+ # defined to suppress the use of dynamic_cast<>, which requires RTTI.
+ 'defines': [
+ 'GOOGLE_PROTOBUF_NO_RTTI',
+ ],
+ 'direct_dependent_settings': {
+ 'defines': [
+ 'GOOGLE_PROTOBUF_NO_RTTI',
+ ],
+ },
+ }],
],
- 'export_dependent_settings': [
- 'protobuf_lite',
+
+ 'include_dirs': [
+ '<(config_h_dir)',
+ 'src/src',
],
+
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '<(config_h_dir)',
+ 'src/src',
+ ],
+ },
},
- {
- 'target_name': 'protoc',
+ { 'target_name': 'protoc',
'type': 'executable',
'sources': [
'src/src/google/protobuf/compiler/code_generator.cc',