Bug 1411450 - Only build files required for the "lite" protobuf runtime. r?glandium draft
authorFrancois Marier <francois@mozilla.com>
Fri, 27 Oct 2017 16:44:11 -0700
changeset 690153 93ffd9468e5e20d2f853ae72fc1c18f7eb6a1213
parent 689810 472231f50c371b30a29f032d1dd736ac00785e1c
child 738518 54325f37c6054e030460b8b638db8e65b35da8df
push id87241
push userfmarier@mozilla.com
push dateWed, 01 Nov 2017 19:06:31 +0000
reviewersglandium
bugs1411450
milestone58.0a1
Bug 1411450 - Only build files required for the "lite" protobuf runtime. r?glandium All of our .proto are optimized for LITE_RUNTIME so we can use libprotobuf-lite instead of the full libprotobuf. devtools does need something that's not part of libprotobuf-lite (gzip streams) and so we add that to our builds. MozReview-Commit-ID: BW8WnTC6pv
toolkit/components/protobuf/README.txt
toolkit/components/protobuf/moz.build
--- a/toolkit/components/protobuf/README.txt
+++ b/toolkit/components/protobuf/README.txt
@@ -13,11 +13,16 @@ 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.
+   files to the unified sources and remove old ones. Note that we only
+   need:
+   - files contained in the `libprotobuf_lite_la_SOURCES` target
+   (https://github.com/google/protobuf/blob/master/src/Makefile.am)
+   - the header files they need
+   - gzip streams (for devtools)
 
 4. Re-generate all .pb.cc and .pb.h files using `$ ./toolkit/components/protobuf/regenerate_cpp_files.sh`.
--- a/toolkit/components/protobuf/moz.build
+++ b/toolkit/components/protobuf/moz.build
@@ -3,76 +3,40 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'General')
 
 EXPORTS.google.protobuf += [
-    'src/google/protobuf/any.h',
-    'src/google/protobuf/any.pb.h',
-    'src/google/protobuf/api.pb.h',
     'src/google/protobuf/arena.h',
     'src/google/protobuf/arena_impl.h',
     'src/google/protobuf/arenastring.h',
-    'src/google/protobuf/descriptor.h',
-    'src/google/protobuf/descriptor.pb.h',
-    'src/google/protobuf/descriptor_database.h',
-    'src/google/protobuf/duration.pb.h',
-    'src/google/protobuf/dynamic_message.h',
-    'src/google/protobuf/empty.pb.h',
     'src/google/protobuf/extension_set.h',
-    'src/google/protobuf/field_mask.pb.h',
-    'src/google/protobuf/generated_enum_reflection.h',
     'src/google/protobuf/generated_enum_util.h',
-    'src/google/protobuf/generated_message_reflection.h',
     'src/google/protobuf/generated_message_table_driven.h',
     'src/google/protobuf/generated_message_table_driven_lite.h',
     'src/google/protobuf/generated_message_util.h',
     'src/google/protobuf/has_bits.h',
     'src/google/protobuf/map.h',
-    'src/google/protobuf/map_entry.h',
     'src/google/protobuf/map_entry_lite.h',
-    'src/google/protobuf/map_field.h',
-    'src/google/protobuf/map_field_inl.h',
-    'src/google/protobuf/map_field_lite.h',
     'src/google/protobuf/map_type_handler.h',
-    'src/google/protobuf/message.h',
     'src/google/protobuf/message_lite.h',
-    'src/google/protobuf/metadata.h',
     'src/google/protobuf/metadata_lite.h',
-    'src/google/protobuf/package_info.h',
-    'src/google/protobuf/reflection.h',
-    'src/google/protobuf/reflection_internal.h',
-    'src/google/protobuf/reflection_ops.h',
     'src/google/protobuf/repeated_field.h',
-    'src/google/protobuf/service.h',
-    'src/google/protobuf/source_context.pb.h',
-    'src/google/protobuf/struct.pb.h',
-    'src/google/protobuf/text_format.h',
-    'src/google/protobuf/timestamp.pb.h',
-    'src/google/protobuf/type.pb.h',
-    'src/google/protobuf/unknown_field_set.h',
-    'src/google/protobuf/wire_format.h',
     'src/google/protobuf/wire_format_lite.h',
     'src/google/protobuf/wire_format_lite_inl.h',
-    'src/google/protobuf/wrappers.pb.h',
 ]
 
 EXPORTS.google.protobuf.io += [
     'src/google/protobuf/io/coded_stream.h',
     'src/google/protobuf/io/coded_stream_inl.h',
     'src/google/protobuf/io/gzip_stream.h',
-    'src/google/protobuf/io/package_info.h',
-    'src/google/protobuf/io/printer.h',
-    'src/google/protobuf/io/strtod.h',
-    'src/google/protobuf/io/tokenizer.h',
     'src/google/protobuf/io/zero_copy_stream.h',
-    'src/google/protobuf/io/zero_copy_stream_impl.h',
     'src/google/protobuf/io/zero_copy_stream_impl_lite.h',
 ]
 
 EXPORTS.google.protobuf.stubs += [
     'src/google/protobuf/stubs/atomic_sequence_num.h',
     'src/google/protobuf/stubs/atomicops.h',
     'src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h',
     'src/google/protobuf/stubs/atomicops_internals_arm_gcc.h',
@@ -94,153 +58,63 @@ EXPORTS.google.protobuf.stubs += [
     'src/google/protobuf/stubs/fastmem.h',
     'src/google/protobuf/stubs/hash.h',
     'src/google/protobuf/stubs/int128.h',
     'src/google/protobuf/stubs/io_win32.h',
     'src/google/protobuf/stubs/logging.h',
     'src/google/protobuf/stubs/macros.h',
     'src/google/protobuf/stubs/map_util.h',
     'src/google/protobuf/stubs/mathlimits.h',
-    'src/google/protobuf/stubs/mathutil.h',
     'src/google/protobuf/stubs/mutex.h',
     'src/google/protobuf/stubs/once.h',
     'src/google/protobuf/stubs/platform_macros.h',
     'src/google/protobuf/stubs/port.h',
     'src/google/protobuf/stubs/scoped_ptr.h',
     'src/google/protobuf/stubs/shared_ptr.h',
-    'src/google/protobuf/stubs/singleton.h',
     'src/google/protobuf/stubs/status.h',
     'src/google/protobuf/stubs/status_macros.h',
     'src/google/protobuf/stubs/statusor.h',
     'src/google/protobuf/stubs/stl_util.h',
     'src/google/protobuf/stubs/stringpiece.h',
     'src/google/protobuf/stubs/stringprintf.h',
     'src/google/protobuf/stubs/strutil.h',
-    'src/google/protobuf/stubs/substitute.h',
     'src/google/protobuf/stubs/template_util.h',
     'src/google/protobuf/stubs/time.h',
     'src/google/protobuf/stubs/type_traits.h',
 ]
 
-EXPORTS.google.protobuf.util += [
-    'src/google/protobuf/util/delimited_message_util.h',
-    'src/google/protobuf/util/field_comparator.h',
-    'src/google/protobuf/util/field_mask_util.h',
-    'src/google/protobuf/util/json_util.h',
-    'src/google/protobuf/util/message_differencer.h',
-    'src/google/protobuf/util/package_info.h',
-    'src/google/protobuf/util/time_util.h',
-    'src/google/protobuf/util/type_resolver.h',
-    'src/google/protobuf/util/type_resolver_util.h',
-]
-
-EXPORTS.google.protobuf.util.internal += [
-    'src/google/protobuf/util/internal/constants.h',
-    'src/google/protobuf/util/internal/datapiece.h',
-    'src/google/protobuf/util/internal/default_value_objectwriter.h',
-    'src/google/protobuf/util/internal/error_listener.h',
-    'src/google/protobuf/util/internal/expecting_objectwriter.h',
-    'src/google/protobuf/util/internal/field_mask_utility.h',
-    'src/google/protobuf/util/internal/json_escaping.h',
-    'src/google/protobuf/util/internal/json_objectwriter.h',
-    'src/google/protobuf/util/internal/json_stream_parser.h',
-    'src/google/protobuf/util/internal/location_tracker.h',
-    'src/google/protobuf/util/internal/mock_error_listener.h',
-    'src/google/protobuf/util/internal/object_location_tracker.h',
-    'src/google/protobuf/util/internal/object_source.h',
-    'src/google/protobuf/util/internal/object_writer.h',
-    'src/google/protobuf/util/internal/proto_writer.h',
-    'src/google/protobuf/util/internal/protostream_objectsource.h',
-    'src/google/protobuf/util/internal/protostream_objectwriter.h',
-    'src/google/protobuf/util/internal/structured_objectwriter.h',
-    'src/google/protobuf/util/internal/type_info.h',
-    'src/google/protobuf/util/internal/utility.h',
-]
-
 UNIFIED_SOURCES += [
-    'src/google/protobuf/any.cc',
-    'src/google/protobuf/any.pb.cc',
-    'src/google/protobuf/api.pb.cc',
     'src/google/protobuf/arena.cc',
     'src/google/protobuf/arenastring.cc',
-    'src/google/protobuf/descriptor.cc',
-    'src/google/protobuf/descriptor.pb.cc',
-    'src/google/protobuf/descriptor_database.cc',
-    'src/google/protobuf/duration.pb.cc',
-    'src/google/protobuf/dynamic_message.cc',
-    'src/google/protobuf/empty.pb.cc',
     'src/google/protobuf/extension_set.cc',
-    'src/google/protobuf/field_mask.pb.cc',
-    'src/google/protobuf/generated_message_reflection.cc',
     'src/google/protobuf/generated_message_util.cc',
     'src/google/protobuf/io/coded_stream.cc',
     'src/google/protobuf/io/gzip_stream.cc',
-    'src/google/protobuf/io/printer.cc',
-    'src/google/protobuf/io/strtod.cc',
-    'src/google/protobuf/io/tokenizer.cc',
     'src/google/protobuf/io/zero_copy_stream.cc',
-    'src/google/protobuf/io/zero_copy_stream_impl.cc',
     'src/google/protobuf/io/zero_copy_stream_impl_lite.cc',
-    'src/google/protobuf/map_field.cc',
-    'src/google/protobuf/message.cc',
     'src/google/protobuf/message_lite.cc',
-    'src/google/protobuf/reflection_ops.cc',
     'src/google/protobuf/repeated_field.cc',
-    'src/google/protobuf/service.cc',
-    'src/google/protobuf/source_context.pb.cc',
-    'src/google/protobuf/struct.pb.cc',
     'src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc',
     'src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc',
     'src/google/protobuf/stubs/bytestream.cc',
     'src/google/protobuf/stubs/common.cc',
     'src/google/protobuf/stubs/int128.cc',
-    'src/google/protobuf/stubs/io_win32.cc',
-    'src/google/protobuf/stubs/mathlimits.cc',
     'src/google/protobuf/stubs/once.cc',
     'src/google/protobuf/stubs/status.cc',
     'src/google/protobuf/stubs/statusor.cc',
     'src/google/protobuf/stubs/stringpiece.cc',
     'src/google/protobuf/stubs/stringprintf.cc',
     'src/google/protobuf/stubs/structurally_valid.cc',
     'src/google/protobuf/stubs/strutil.cc',
-    'src/google/protobuf/stubs/substitute.cc',
-    'src/google/protobuf/text_format.cc',
-    'src/google/protobuf/timestamp.pb.cc',
-    'src/google/protobuf/type.pb.cc',
-    'src/google/protobuf/unknown_field_set.cc',
-    'src/google/protobuf/util/delimited_message_util.cc',
-    'src/google/protobuf/util/field_comparator.cc',
-    'src/google/protobuf/util/field_mask_util.cc',
-    'src/google/protobuf/util/internal/datapiece.cc',
-    'src/google/protobuf/util/internal/default_value_objectwriter.cc',
-    'src/google/protobuf/util/internal/error_listener.cc',
-    'src/google/protobuf/util/internal/field_mask_utility.cc',
-    'src/google/protobuf/util/internal/object_writer.cc',
-    'src/google/protobuf/util/internal/type_info.cc',
-    'src/google/protobuf/util/internal/utility.cc',
-    'src/google/protobuf/util/json_util.cc',
-    'src/google/protobuf/util/type_resolver_util.cc',
     'src/google/protobuf/wire_format_lite.cc',
-    'src/google/protobuf/wrappers.pb.cc',
 ]
 
 SOURCES += [
-    'src/google/protobuf/extension_set_heavy.cc',
-    'src/google/protobuf/generated_message_table_driven.cc',
     'src/google/protobuf/generated_message_table_driven_lite.cc',
     'src/google/protobuf/stubs/time.cc',  # GetCurrentTime conflict in winbase.h
-    'src/google/protobuf/util/internal/json_escaping.cc',  # namespace problem in json_escaping.h
-    'src/google/protobuf/util/internal/json_objectwriter.cc',  # namespace problem in json_escaping.h
-    'src/google/protobuf/util/internal/json_stream_parser.cc',
-    'src/google/protobuf/util/internal/proto_writer.cc',  # GetCurrentTime conflict in winbase.h
-    'src/google/protobuf/util/internal/protostream_objectsource.cc',  # GetCurrentTime conflict in winbase.h
-    'src/google/protobuf/util/internal/protostream_objectwriter.cc',  # GetCurrentTime conflict in winbase.h
-    'src/google/protobuf/util/message_differencer.cc',
-    'src/google/protobuf/util/time_util.cc',  # GetCurrentTime conflict in winbase.h
-    'src/google/protobuf/wire_format.cc',  # GetMessage conflict in windows.h
 ]
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True