From 724f0be33d0eb42055ebe81ce0c8c7bf88ea666c Mon Sep 17 00:00:00 2001 From: John Millikin Date: Sat, 24 Feb 2018 11:34:40 -0800 Subject: Move `compiler/plugin.pb.cc` to libprotobuf with the other WKT sources. This lets all values of `WELL_KNOWN_PROTOS` be treated the same with regard to Bazel's protobuf blacklisting. --- BUILD | 2 +- cmake/libprotobuf.cmake | 1 + cmake/libprotoc.cmake | 1 - src/Makefile.am | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILD b/BUILD index b786ff64..88d8b807 100644 --- a/BUILD +++ b/BUILD @@ -121,6 +121,7 @@ cc_library( "src/google/protobuf/api.pb.cc", "src/google/protobuf/compiler/importer.cc", "src/google/protobuf/compiler/parser.cc", + "src/google/protobuf/compiler/plugin.pb.cc", "src/google/protobuf/descriptor.cc", "src/google/protobuf/descriptor.pb.cc", "src/google/protobuf/descriptor_database.cc", @@ -378,7 +379,6 @@ cc_library( "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", "src/google/protobuf/compiler/php/php_generator.cc", "src/google/protobuf/compiler/plugin.cc", - "src/google/protobuf/compiler/plugin.pb.cc", "src/google/protobuf/compiler/python/python_generator.cc", "src/google/protobuf/compiler/ruby/ruby_generator.cc", "src/google/protobuf/compiler/subprocess.cc", diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake index 65d05c19..173d2ab9 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -4,6 +4,7 @@ set(libprotobuf_files ${protobuf_source_dir}/src/google/protobuf/api.pb.cc ${protobuf_source_dir}/src/google/protobuf/compiler/importer.cc ${protobuf_source_dir}/src/google/protobuf/compiler/parser.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc ${protobuf_source_dir}/src/google/protobuf/descriptor.cc ${protobuf_source_dir}/src/google/protobuf/descriptor.pb.cc ${protobuf_source_dir}/src/google/protobuf/descriptor_database.cc diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake index 5f6d078c..dbf52daf 100644 --- a/cmake/libprotoc.cmake +++ b/cmake/libprotoc.cmake @@ -88,7 +88,6 @@ set(libprotoc_files ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc diff --git a/src/Makefile.am b/src/Makefile.am index af2db52f..6eac2e15 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -278,6 +278,7 @@ libprotobuf_la_SOURCES = \ google/protobuf/io/zero_copy_stream_impl.cc \ google/protobuf/compiler/importer.cc \ google/protobuf/compiler/parser.cc \ + google/protobuf/compiler/plugin.pb.cc \ google/protobuf/util/delimited_message_util.cc \ google/protobuf/util/field_comparator.cc \ google/protobuf/util/field_mask_util.cc \ @@ -333,7 +334,6 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/code_generator.cc \ google/protobuf/compiler/command_line_interface.cc \ google/protobuf/compiler/plugin.cc \ - google/protobuf/compiler/plugin.pb.cc \ google/protobuf/compiler/subprocess.cc \ google/protobuf/compiler/subprocess.h \ google/protobuf/compiler/zip_writer.cc \ -- cgit v1.2.3 From 350b135e233ba607e5cbc08a4f8b824d20f4b9c9 Mon Sep 17 00:00:00 2001 From: John Millikin Date: Sat, 24 Feb 2018 11:36:49 -0800 Subject: Blacklist all WELL_KNOWN_PROTOS from Bazel C++ code generation. This prevents the Bazel `CcProtoAspect` from generating and linking C++ object code for these files. Without this blacklist, symbols for protobuf types depended on by `libprotobuf` may be defined multiple times and violate the ODR rule. Fixes https://github.com/google/protobuf/issues/4311 --- BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD b/BUILD index 88d8b807..ee81c759 100644 --- a/BUILD +++ b/BUILD @@ -843,6 +843,7 @@ proto_lang_toolchain( command_line = "--cpp_out=$(OUT)", runtime = ":protobuf", visibility = ["//visibility:public"], + blacklisted_protos = [":_internal_wkt_protos_genrule"], ) proto_lang_toolchain( -- cgit v1.2.3