diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index a8736c337b..7fdd80a790 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -146,10 +146,35 @@ cc_library( "repeated_ptr_field.cc", "wire_format_lite.cc", ], - hdrs = glob([ - "**/*.h", - "**/*.inc", - ]), + hdrs = [ + "any.h", + "arena.h", + "arena_impl.h", + "arenastring.h", + "arenaz_sampler.h", + "endian.h", + "explicitly_constructed.h", + "extension_set.h", + "extension_set_inl.h", + "generated_enum_util.h", + "generated_message_tctable_decl.h", + "generated_message_tctable_impl.h", + "generated_message_util.h", + "has_bits.h", + "implicit_weak_message.h", + "inlined_string_field.h", + "map.h", + "map_entry_lite.h", + "map_field_lite.h", + "map_type_handler.h", + "message_lite.h", + "metadata_lite.h", + "parse_context.h", + "port.h", + "repeated_field.h", + "repeated_ptr_field.h", + "wire_format_lite.h", + ], copts = COPTS + select({ "//build_defs:config_msvc": [], "//conditions:default": [ @@ -201,10 +226,38 @@ cc_library( "wire_format.cc", "wrappers.pb.cc", ], - hdrs = glob([ - "**/*.h", - "**/*.inc", - ]), + hdrs = [ + "any.pb.h", + "api.pb.h", + "descriptor.h", + "descriptor.pb.h", + "descriptor_database.h", + "duration.pb.h", + "dynamic_message.h", + "empty.pb.h", + "field_access_listener.h", + "field_mask.pb.h", + "generated_enum_reflection.h", + "generated_message_bases.h", + "generated_message_reflection.h", + "map_entry.h", + "map_field.h", + "map_field_inl.h", + "message.h", + "metadata.h", + "reflection.h", + "reflection_internal.h", + "reflection_ops.h", + "service.h", + "source_context.pb.h", + "struct.pb.h", + "text_format.h", + "timestamp.pb.h", + "type.pb.h", + "unknown_field_set.h", + "wire_format.h", + "wrappers.pb.h", + ], copts = COPTS, include_prefix = "google/protobuf", linkopts = LINK_OPTS, @@ -454,11 +507,17 @@ cc_library( hdrs = [ "arena_test_util.h", "map_lite_test_util.h", + "map_test.inc", "map_test_util.h", + "map_test_util.inc", "map_test_util_impl.h", + "message_unittest.inc", + "proto3_lite_unittest.inc", + "reflection_tester.h", "test_util.h", - "test_util2.h", + "test_util.inc", "test_util_lite.h", + "wire_format_unittest.inc", ], copts = COPTS + select({ "//build_defs:config_msvc": [], @@ -467,10 +526,6 @@ cc_library( ], }), strip_include_prefix = "/src", - textual_hdrs = [ - "map_test_util.inc", - "test_util.inc", - ], visibility = ["//:__subpackages__"], deps = [ ":cc_lite_test_protos", @@ -479,6 +534,19 @@ cc_library( ], ) +cc_library( + name = "test_util2", + testonly = 1, + hdrs = ["test_util2.h"], + strip_include_prefix = "/src", + textual_hdrs = ["test_util.inc"], + visibility = ["//:__subpackages__"], + deps = [ + "//src/google/protobuf/io", + "@com_google_googletest//:gtest", + ], +) + cc_test( name = "protobuf_test", srcs = [ @@ -496,15 +564,12 @@ cc_test( "inlined_string_field_unittest.cc", "map_field_test.cc", "map_test.cc", - "map_test.inc", "message_unittest.cc", - "message_unittest.inc", "no_field_presence_test.cc", "preserve_unknown_enum_test.cc", "proto3_arena_lite_unittest.cc", "proto3_arena_unittest.cc", "proto3_lite_unittest.cc", - "proto3_lite_unittest.inc", "reflection_ops_unittest.cc", "repeated_field_reflection_unittest.cc", "repeated_field_unittest.cc", @@ -512,7 +577,6 @@ cc_test( "unknown_field_set_unittest.cc", "well_known_types_unittest.cc", "wire_format_unittest.cc", - "wire_format_unittest.inc", ], copts = COPTS + select({ "//build_defs:config_msvc": [], @@ -532,11 +596,13 @@ cc_test( ":cc_test_protos", ":protobuf", ":test_util", + ":test_util2", "//src/google/protobuf/testing", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) + ################################################################################ # Helper targets for Kotlin tests ################################################################################ diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index 8da74f10a7..75b90e411b 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -199,6 +199,7 @@ cc_test( ":mock_code_generator", "//:protobuf", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_util2", "//src/google/protobuf/io", "//src/google/protobuf/stubs", "//src/google/protobuf/testing", @@ -236,6 +237,7 @@ cc_test( ":importer", "//:protobuf", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_util2", "//src/google/protobuf/io", "//src/google/protobuf/stubs", "//src/google/protobuf/testing", diff --git a/src/google/protobuf/compiler/cpp/BUILD.bazel b/src/google/protobuf/compiler/cpp/BUILD.bazel index b14259495c..557580926b 100644 --- a/src/google/protobuf/compiler/cpp/BUILD.bazel +++ b/src/google/protobuf/compiler/cpp/BUILD.bazel @@ -107,6 +107,8 @@ cc_test( ":unittest_lib", "//:protobuf", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_util", + "//src/google/protobuf:test_util2", "//src/google/protobuf/compiler:importer", "//src/google/protobuf/io", "//src/google/protobuf/stubs", @@ -129,6 +131,7 @@ cc_test( deps = [ ":cpp", "//:protobuf", + "//src/google/protobuf:test_util2", "//src/google/protobuf/compiler:importer", "//src/google/protobuf/io", "//src/google/protobuf/stubs", diff --git a/src/google/protobuf/io/BUILD.bazel b/src/google/protobuf/io/BUILD.bazel index 7582f78bcd..be7fb4c4bc 100644 --- a/src/google/protobuf/io/BUILD.bazel +++ b/src/google/protobuf/io/BUILD.bazel @@ -114,6 +114,7 @@ cc_test( ":gzip_stream", ":io", "//:protobuf", + "//src/google/protobuf:test_util2", "//src/google/protobuf/testing", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", diff --git a/src/google/protobuf/util/BUILD.bazel b/src/google/protobuf/util/BUILD.bazel index 4fb8319d20..cf7bb1a4f6 100644 --- a/src/google/protobuf/util/BUILD.bazel +++ b/src/google/protobuf/util/BUILD.bazel @@ -27,6 +27,7 @@ cc_test( deps = [ ":delimited_message_util", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_util", "//src/google/protobuf/testing", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main",