From 4ec9170bcdfaba23c15fbbc90917e6316a99cc86 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Thu, 28 Dec 2023 14:40:25 -0800 Subject: [PATCH] Fix layering check for usage of gtest To satisfy the layering check, we need to depend on :gtest for the headers, in addition to :gtest_main which provides the main() function. There are a bunch of formatting changes as a side effect of this, but they should be harmless. PiperOrigin-RevId: 594318263 --- bazel/BUILD | 2 +- bazel/build_defs.bzl | 8 ++-- .../cc_library_func.bzl | 1 + benchmarks/BUILD | 3 +- java/internal/testing.bzl | 2 +- protos/BUILD | 11 +++-- protos/bazel/BUILD | 2 +- protos/bazel/upb_cc_proto_library.bzl | 1 + protos_generator/BUILD | 4 +- protos_generator/tests/BUILD | 3 +- python/BUILD.bazel | 15 ++++--- python/pb_unit_tests/BUILD | 15 ++++--- rust/BUILD | 3 +- rust/cpp_kernel/BUILD | 4 +- rust/test/BUILD | 5 +++ rust/test/cpp/interop/BUILD | 4 +- rust/test/shared/BUILD | 44 +++++++++---------- rust/upb_kernel/BUILD | 2 +- src/google/protobuf/editions/BUILD | 3 ++ third_party/utf8_range/BUILD.bazel | 1 + upb/BUILD | 6 +-- upb/base/BUILD | 4 +- upb/collections/BUILD | 4 +- upb/hash/BUILD | 7 +-- upb/io/BUILD | 13 +++--- upb/json/BUILD | 9 ++-- upb/lex/BUILD | 7 +-- upb/mem/BUILD | 7 +-- upb/message/BUILD | 26 +++++++---- upb/mini_descriptor/BUILD | 7 +-- upb/mini_table/BUILD | 7 +-- upb/port/BUILD | 4 +- upb/reflection/BUILD | 7 +-- upb/test/BUILD | 17 ++++--- upb/text/BUILD | 4 +- upb/util/BUILD | 12 +++-- upb/wire/BUILD | 9 ++-- 37 files changed, 166 insertions(+), 117 deletions(-) diff --git a/bazel/BUILD b/bazel/BUILD index be2e946f4c..90d578fd50 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -52,8 +52,8 @@ bzl_library( ], deps = [ "@bazel_skylib//lib:paths", - "@rules_proto//proto:defs", "@bazel_tools//tools/cpp:toolchain_utils.bzl", + "@rules_proto//proto:defs", ], ) diff --git a/bazel/build_defs.bzl b/bazel/build_defs.bzl index 1ed1ffe40c..2da636871e 100644 --- a/bazel/build_defs.bzl +++ b/bazel/build_defs.bzl @@ -31,8 +31,8 @@ _DEFAULT_COPTS.extend([ UPB_DEFAULT_CPPOPTS = select({ "//upb:windows": [], # begin:google_only -# # Override default -Oz for release builds on Android. -# "//bazel:android_opt": _DEFAULT_CPPOPTS + ["-O2"], + # # Override default -Oz for release builds on Android. + # "//bazel:android_opt": _DEFAULT_CPPOPTS + ["-O2"], # end:google_only "//conditions:default": _DEFAULT_CPPOPTS, }) @@ -41,8 +41,8 @@ UPB_DEFAULT_COPTS = select({ "//upb:windows": [], "//upb:fasttable_enabled_setting": ["-std=gnu99", "-DUPB_ENABLE_FASTTABLE"], # begin:google_only -# # Override default -Oz for release builds on Android. -# "//bazel:android_opt": _DEFAULT_COPTS + ["-O2"], + # # Override default -Oz for release builds on Android. + # "//bazel:android_opt": _DEFAULT_COPTS + ["-O2"], # end:google_only "//conditions:default": _DEFAULT_COPTS, }) diff --git a/bazel/upb_proto_library_internal/cc_library_func.bzl b/bazel/upb_proto_library_internal/cc_library_func.bzl index 31ebe9057b..0c567ce8d4 100644 --- a/bazel/upb_proto_library_internal/cc_library_func.bzl +++ b/bazel/upb_proto_library_internal/cc_library_func.bzl @@ -14,6 +14,7 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") def upb_use_cpp_toolchain(): return ["@bazel_tools//tools/cpp:toolchain_type"] + # end:github_only def cc_library_func(ctx, name, hdrs, srcs, copts, includes, dep_ccinfos): diff --git a/benchmarks/BUILD b/benchmarks/BUILD index b975bac8e3..3b9a9cbde0 100644 --- a/benchmarks/BUILD +++ b/benchmarks/BUILD @@ -76,7 +76,6 @@ cc_test( ":benchmark_descriptor_upb_proto", ":benchmark_descriptor_upb_proto_reflection", "//:protobuf", - "@com_google_googletest//:gtest_main", "//src/google/protobuf/json", "//upb:base", "//upb:descriptor_upb_proto", @@ -88,6 +87,8 @@ cc_test( "@com_github_google_benchmark//:benchmark_main", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/log:absl_check", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) diff --git a/java/internal/testing.bzl b/java/internal/testing.bzl index b2a781baba..ee8f80f262 100644 --- a/java/internal/testing.bzl +++ b/java/internal/testing.bzl @@ -52,7 +52,7 @@ def junit_tests(name, srcs, data = [], deps = [], package_name = "com.google.pro if test_prefix: test_name = "%s%s" % (test_prefix, test_name) test_names = test_names + [test_name] - suite_name = prefix + '_' + test_name + suite_name = prefix + "_" + test_name _gen_suite( name = suite_name, srcs = [src], diff --git a/protos/BUILD b/protos/BUILD index 7712c38bcb..f903249a04 100644 --- a/protos/BUILD +++ b/protos/BUILD @@ -132,10 +132,11 @@ cc_test( copts = UPB_DEFAULT_CPPOPTS, deps = [ ":protos_internal", - "@com_google_googletest//:gtest_main", - "//upb:mem", "//protos_generator/tests:test_model_upb_cc_proto", "//protos_generator/tests:test_model_upb_proto", + "//upb:mem", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -150,6 +151,7 @@ cc_test( srcs = ["repeated_field_iterator_test.cc"], deps = [ ":repeated_field", + "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) @@ -158,12 +160,13 @@ cc_test( name = "protos_extension_lock_test", srcs = ["protos_extension_lock_test.cc"], deps = [ - "@com_google_googletest//:gtest_main", - "//upb:mem", "//protos", "//protos:protos_extension_lock", "//protos_generator/tests:test_model_upb_cc_proto", + "//upb:mem", "@com_google_absl//absl/hash", "@com_google_absl//absl/log:absl_check", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) diff --git a/protos/bazel/BUILD b/protos/bazel/BUILD index ea91541adf..7381375fed 100644 --- a/protos/bazel/BUILD +++ b/protos/bazel/BUILD @@ -18,8 +18,8 @@ bzl_library( srcs = ["upb_cc_proto_library.bzl"], visibility = ["//visibility:public"], deps = [ - "@bazel_skylib//lib:paths", "//bazel:upb_proto_library_bzl", + "@bazel_skylib//lib:paths", "@bazel_tools//tools/cpp:toolchain_utils.bzl", ], ) diff --git a/protos/bazel/upb_cc_proto_library.bzl b/protos/bazel/upb_cc_proto_library.bzl index ad193b4a8a..cacf709a61 100644 --- a/protos/bazel/upb_cc_proto_library.bzl +++ b/protos/bazel/upb_cc_proto_library.bzl @@ -22,6 +22,7 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") def use_cpp_toolchain(): return ["@bazel_tools//tools/cpp:toolchain_type"] + # end:github_only # Generic support code ######################################################### diff --git a/protos_generator/BUILD b/protos_generator/BUILD index ac8cfeca8b..d76c944fae 100644 --- a/protos_generator/BUILD +++ b/protos_generator/BUILD @@ -56,12 +56,12 @@ cc_library( ":names", ":output", "//:protobuf", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/strings", "//upb_generator:common", "//upb_generator:file_layout", "//upb_generator:keywords", "//upb_generator:names", + "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/strings", ], ) diff --git a/protos_generator/tests/BUILD b/protos_generator/tests/BUILD index c47a71fec4..8ebb985531 100644 --- a/protos_generator/tests/BUILD +++ b/protos_generator/tests/BUILD @@ -124,12 +124,13 @@ cc_test( copts = UPB_DEFAULT_CPPOPTS, deps = [ # begin:google_only -# ":legacy_name_test_proto", + # ":legacy_name_test_proto", # end:google_only ":no_package_upb_cc_proto", ":test_model_upb_cc_proto", ":test_model_upb_proto", ":naming_conflict_upb_cc_proto", + "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 608381c274..8967bacb3d 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -13,6 +13,7 @@ load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS") # begin:github_only load("@rules_pkg//:mappings.bzl", "pkg_files") load("//python:build_targets.bzl", "build_targets") + build_targets(name = "python") # end:github_only @@ -20,7 +21,7 @@ licenses(["notice"]) package( # begin:google_only -# default_applicable_licenses = ["//upb:license"], + # default_applicable_licenses = ["//upb:license"], # end:google_only default_visibility = ["//python/dist:__pkg__"], ) @@ -136,10 +137,10 @@ selects.config_setting_group( # begin:github_only _message_target_compatible_with = { - "@platforms//os:windows": ["@platforms//:incompatible"], - "@system_python//:none": ["@platforms//:incompatible"], - "@system_python//:unsupported": ["@platforms//:incompatible"], - "//conditions:default": [], + "@platforms//os:windows": ["@platforms//:incompatible"], + "@system_python//:none": ["@platforms//:incompatible"], + "@system_python//:unsupported": ["@platforms//:incompatible"], + "//conditions:default": [], } # end:github_only @@ -176,7 +177,7 @@ filegroup( "unknown_fields.h", ], # begin:google_only -# compatible_with = ["//buildenv/target:non_prod"], + # compatible_with = ["//buildenv/target:non_prod"], # end:google_only ) @@ -190,6 +191,7 @@ py_extension( ], target_compatible_with = select(_message_target_compatible_with), deps = [ + "//third_party/utf8_range", "//upb:base", "//upb:descriptor_upb_proto_reflection", "//upb:eps_copy_input_stream", @@ -203,6 +205,5 @@ py_extension( "//upb/util:compare", "//upb/util:def_to_proto", "//upb/util:required_fields", - "//third_party/utf8_range", ], ) diff --git a/python/pb_unit_tests/BUILD b/python/pb_unit_tests/BUILD index 56ee25086d..8bb43dcc4e 100644 --- a/python/pb_unit_tests/BUILD +++ b/python/pb_unit_tests/BUILD @@ -6,6 +6,7 @@ # https://developers.google.com/open-source/licenses/bsd load(":pyproto_test_wrapper.bzl", "pyproto_test_wrapper") + # begin:github_only load("@pip_deps//:requirements.bzl", "requirement") # end:github_only @@ -39,15 +40,15 @@ py_test( name = "numpy_test", srcs = ["numpy_test_wrapper.py"], main = "numpy_test_wrapper.py", - deps = [ - requirement("numpy"), - "//python/google/protobuf/internal/numpy:numpy_test", - "//python:_message", - ], target_compatible_with = select({ - "@system_python//:supported": [], - "//conditions:default": ["@platforms//:incompatible"], + "@system_python//:supported": [], + "//conditions:default": ["@platforms//:incompatible"], }), + deps = [ + requirement("numpy"), + "//python:_message", + "//python/google/protobuf/internal/numpy:numpy_test", + ], ) # end:github_only diff --git a/rust/BUILD b/rust/BUILD index b3374f434f..62ae297d66 100644 --- a/rust/BUILD +++ b/rust/BUILD @@ -2,7 +2,6 @@ load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") load("@bazel_skylib//rules:common_settings.bzl", "string_flag") - load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain") package( @@ -74,8 +73,8 @@ rust_library( ], rustc_flags = ["--cfg=upb_kernel"], visibility = [ - "//src/google/protobuf:__subpackages__", "//rust:__subpackages__", + "//src/google/protobuf:__subpackages__", ], deps = [ ":utf8", diff --git a/rust/cpp_kernel/BUILD b/rust/cpp_kernel/BUILD index e9baa3a467..6582b03898 100644 --- a/rust/cpp_kernel/BUILD +++ b/rust/cpp_kernel/BUILD @@ -7,13 +7,13 @@ cc_library( srcs = ["cpp_api.cc"], hdrs = ["cpp_api.h"], visibility = [ - "//src/google/protobuf:__subpackages__", "//rust:__subpackages__", + "//src/google/protobuf:__subpackages__", ], deps = [ ":rust_alloc_for_cpp_api", # buildcleaner: keep - "@com_google_absl//absl/strings:string_view", "//:protobuf_nowkt", + "@com_google_absl//absl/strings:string_view", ], ) diff --git a/rust/test/BUILD b/rust/test/BUILD index 186374fb9c..2541732ebe 100644 --- a/rust/test/BUILD +++ b/rust/test/BUILD @@ -7,10 +7,15 @@ load( load("@rules_cc//cc:defs.bzl", "cc_proto_library") UNITTEST_PROTO_TARGET = "//src/google/protobuf:test_protos" + UNITTEST_CC_PROTO_TARGET = "//src/google/protobuf:cc_test_protos" + UNITTEST_PROTO3_TARGET = "//src/google/protobuf:test_protos" + UNITTEST_PROTO3_CC_TARGET = "//src/google/protobuf:cc_test_protos" + UNITTEST_PROTO3_OPTIONAL_TARGET = "//src/google/protobuf:test_protos" + UNITTEST_PROTO3_OPTIONAL_CC_TARGET = "//src/google/protobuf:cc_test_protos" alias( diff --git a/rust/test/cpp/interop/BUILD b/rust/test/cpp/interop/BUILD index bacd078cf0..abbf0d224f 100644 --- a/rust/test/cpp/interop/BUILD +++ b/rust/test/cpp/interop/BUILD @@ -6,9 +6,9 @@ cc_library( name = "test_utils", srcs = ["test_utils.cc"], deps = [ - "@com_google_absl//absl/strings", "//rust/cpp_kernel:cpp_api", "//rust/test:unittest_cc_proto", + "@com_google_absl//absl/strings", ], ) @@ -21,8 +21,8 @@ rust_test( ], deps = [ ":test_utils", - "@crate_index//:googletest", "//rust:protobuf_cpp", "//rust/test:unittest_cc_rust_proto", + "@crate_index//:googletest", ], ) diff --git a/rust/test/shared/BUILD b/rust/test/shared/BUILD index 3a61c4d143..9fb9a1bd00 100644 --- a/rust/test/shared/BUILD +++ b/rust/test/shared/BUILD @@ -23,8 +23,8 @@ rust_library( "//rust:protobuf_upb": "protobuf", }, deps = [ - "@crate_index//:googletest", "//rust:protobuf_upb", + "@crate_index//:googletest", ], ) @@ -35,8 +35,8 @@ rust_library( "//rust:protobuf_cpp": "protobuf", }, deps = [ - "@crate_index//:googletest", "//rust:protobuf_cpp", + "@crate_index//:googletest", ], ) @@ -48,9 +48,9 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:child_upb_rust_proto", "//rust/test:parent_upb_rust_proto", + "@crate_index//:googletest", ], ) @@ -62,9 +62,9 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:child_cc_rust_proto", "//rust/test:parent_cc_rust_proto", + "@crate_index//:googletest", ], ) @@ -76,8 +76,8 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:edition2023_cc_rust_proto", + "@crate_index//:googletest", ], ) @@ -89,8 +89,8 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:edition2023_upb_rust_proto", + "@crate_index//:googletest", ], ) @@ -105,10 +105,10 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust:protobuf_cpp", "//rust/test:enums_cc_rust_proto", "//rust/test:unittest_cc_rust_proto", + "@crate_index//:googletest", ], ) @@ -123,10 +123,10 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust:protobuf_upb", "//rust/test:enums_upb_rust_proto", "//rust/test:unittest_upb_rust_proto", + "@crate_index//:googletest", ], ) @@ -166,9 +166,9 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:reserved_cc_rust_proto", "//rust/test:unittest_cc_rust_proto", + "@crate_index//:googletest", ], ) @@ -180,9 +180,9 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:reserved_upb_rust_proto", "//rust/test:unittest_upb_rust_proto", + "@crate_index//:googletest", ], ) @@ -221,10 +221,10 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust:protobuf_cpp", "//rust/test:unittest_cc_rust_proto", "//rust/test/shared:matchers_cpp", + "@crate_index//:googletest", ], ) @@ -243,10 +243,10 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust:protobuf_upb", "//rust/test:unittest_upb_rust_proto", "//rust/test/shared:matchers_upb", + "@crate_index//:googletest", ], ) @@ -262,11 +262,11 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust:protobuf_cpp", "//rust/test:unittest_proto3_cc_rust_proto", "//rust/test:unittest_proto3_optional_cc_rust_proto", "//rust/test/shared:matchers_cpp", + "@crate_index//:googletest", ], ) @@ -282,11 +282,11 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust:protobuf_upb", "//rust/test:unittest_proto3_optional_upb_rust_proto", "//rust/test:unittest_proto3_upb_rust_proto", "//rust/test/shared:matchers_upb", + "@crate_index//:googletest", ], ) @@ -298,8 +298,8 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:unittest_upb_rust_proto", + "@crate_index//:googletest", ], ) @@ -311,8 +311,8 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:unittest_cc_rust_proto", + "@crate_index//:googletest", ], ) @@ -324,8 +324,8 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:nested_cc_rust_proto", + "@crate_index//:googletest", ], ) @@ -337,8 +337,8 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:nested_upb_rust_proto", + "@crate_index//:googletest", ], ) @@ -356,9 +356,9 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust:protobuf_cpp", "//rust/test:unittest_cc_rust_proto", + "@crate_index//:googletest", ], ) @@ -376,9 +376,9 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust:protobuf_upb", "//rust/test:unittest_upb_rust_proto", + "@crate_index//:googletest", ], ) @@ -393,8 +393,8 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:map_unittest_cc_rust_proto", + "@crate_index//:googletest", ], ) @@ -409,7 +409,7 @@ rust_test( "not_build:arm", ], deps = [ - "@crate_index//:googletest", "//rust/test:map_unittest_upb_rust_proto", + "@crate_index//:googletest", ], ) diff --git a/rust/upb_kernel/BUILD b/rust/upb_kernel/BUILD index 3c373323e0..62ae49a3f8 100644 --- a/rust/upb_kernel/BUILD +++ b/rust/upb_kernel/BUILD @@ -4,8 +4,8 @@ cc_library( name = "upb_c_api", srcs = ["upb_api.c"], visibility = [ - "//src/google/protobuf:__subpackages__", "//rust:__subpackages__", + "//src/google/protobuf:__subpackages__", ], deps = [ "//upb:mem", diff --git a/src/google/protobuf/editions/BUILD b/src/google/protobuf/editions/BUILD index 52c6a402df..76d1a0ed61 100644 --- a/src/google/protobuf/editions/BUILD +++ b/src/google/protobuf/editions/BUILD @@ -84,6 +84,7 @@ cc_test( "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:string_view", + "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) @@ -246,6 +247,7 @@ cc_test( ":test_messages_proto3_editions_cc_proto", "//:protobuf", "//src/google/protobuf:test_textproto", + "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) @@ -255,6 +257,7 @@ cc_test( srcs = ["generated_reflection_test.cc"], deps = [ ":test_messages_proto2_editions_cc_proto", + "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) diff --git a/third_party/utf8_range/BUILD.bazel b/third_party/utf8_range/BUILD.bazel index d24e8a1431..fdc1a49b1e 100644 --- a/third_party/utf8_range/BUILD.bazel +++ b/third_party/utf8_range/BUILD.bazel @@ -59,6 +59,7 @@ cc_test( ":utf8_range", ":utf8_validity", "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) diff --git a/upb/BUILD b/upb/BUILD index e6cdff77dd..13047648e5 100644 --- a/upb/BUILD +++ b/upb/BUILD @@ -498,16 +498,16 @@ filegroup( "**/*.c", "**/*.h", "**/*.hpp", - ], + ], exclude = [ "**/conformance_upb.c", "reflection/stage0/**/*", ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/base/BUILD b/upb/base/BUILD index 1a025c295d..2fce94baf5 100644 --- a/upb/base/BUILD +++ b/upb/base/BUILD @@ -47,8 +47,8 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/collections/BUILD b/upb/collections/BUILD index 8437cd598a..5a900c6c7b 100644 --- a/upb/collections/BUILD +++ b/upb/collections/BUILD @@ -29,8 +29,8 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/hash/BUILD b/upb/hash/BUILD index 7ef3bd7e0d..b061413e8d 100644 --- a/upb/hash/BUILD +++ b/upb/hash/BUILD @@ -32,10 +32,11 @@ cc_test( srcs = ["test.cc"], deps = [ ":hash", - "@com_google_googletest//:gtest_main", "//upb:mem", "//upb:port", "@com_google_absl//absl/container:flat_hash_map", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -49,9 +50,9 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/io/BUILD b/upb/io/BUILD index 31648646ba..490096a153 100644 --- a/upb/io/BUILD +++ b/upb/io/BUILD @@ -64,8 +64,9 @@ cc_test( srcs = ["string_test.cc"], deps = [ ":string", - "@com_google_googletest//:gtest_main", "//upb:mem", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -78,12 +79,13 @@ cc_test( ":string", ":tokenizer", ":zero_copy_stream", - "@com_google_googletest//:gtest_main", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", "//upb:lex", "//upb:mem", "//upb:port", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -96,8 +98,9 @@ cc_test( deps = [ ":chunked_stream", ":zero_copy_stream", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) diff --git a/upb/json/BUILD b/upb/json/BUILD index b04c4fdb32..6331725465 100644 --- a/upb/json/BUILD +++ b/upb/json/BUILD @@ -40,10 +40,11 @@ cc_test( ":struct_upb_proto", ":test_upb_proto", ":test_upb_proto_reflection", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:reflection", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -55,10 +56,11 @@ cc_test( ":struct_upb_proto", ":test_upb_proto", ":test_upb_proto_reflection", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:reflection", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -96,7 +98,7 @@ upb_c_proto_library( # ":json", # ":test_upb_proto", # ":test_upb_proto_reflection", -# "@com_google_googletest//:gtest_main", +# "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", # "//testing/fuzzing:fuzztest", # "//upb:base", # "//upb:mem", @@ -118,6 +120,7 @@ filegroup( ), visibility = ["//pkg:__pkg__"], ) + filegroup( name = "test_utils", srcs = glob( diff --git a/upb/lex/BUILD b/upb/lex/BUILD index 2dbf258e74..81c6c898a2 100644 --- a/upb/lex/BUILD +++ b/upb/lex/BUILD @@ -31,8 +31,9 @@ cc_test( srcs = ["atoi_test.cc"], deps = [ ":lex", - "@com_google_googletest//:gtest_main", "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -46,9 +47,9 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/mem/BUILD b/upb/mem/BUILD index a26b92eca5..9227a3194e 100644 --- a/upb/mem/BUILD +++ b/upb/mem/BUILD @@ -43,12 +43,13 @@ cc_test( srcs = ["arena_test.cc"], deps = [ ":mem", - "@com_google_googletest//:gtest_main", "//upb:port", "@com_google_absl//absl/random", "@com_google_absl//absl/random:distributions", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -63,9 +64,9 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/message/BUILD b/upb/message/BUILD index 76eb94c3de..969b2ecaca 100644 --- a/upb/message/BUILD +++ b/upb/message/BUILD @@ -228,7 +228,6 @@ cc_test( ":accessors", ":message", "//:protobuf", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:mini_descriptor", @@ -242,6 +241,8 @@ cc_test( "//upb/test:test_messages_proto3_upb_proto", "//upb/test:test_upb_proto", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -250,9 +251,10 @@ cc_test( srcs = ["array_test.cc"], deps = [ ":message", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -264,7 +266,6 @@ cc_test( ":copy", ":message", "//:protobuf", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:mini_table", @@ -274,6 +275,8 @@ cc_test( "//upb/test:test_messages_proto2_upb_proto", "//upb/test:test_upb_proto", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -282,9 +285,10 @@ cc_test( srcs = ["map_test.cc"], deps = [ ":message", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -298,7 +302,6 @@ cc_test( ":promote", ":tagged_ptr", "//:protobuf", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:mini_descriptor", @@ -310,6 +313,8 @@ cc_test( "//upb/test:test_proto_upb_minitable", "//upb/test:test_upb_proto", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -323,7 +328,6 @@ cc_test( ":message_test_upb_proto", ":message_test_upb_proto_reflection", ":value", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:json", "//upb:mem", @@ -333,6 +337,8 @@ cc_test( "//upb:wire", "//upb/test:fuzz_util", "//upb/test:test_messages_proto3_upb_proto", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -361,10 +367,11 @@ cc_test( deps = [ ":utf8_test_upb_minitable_proto", ":utf8_test_upb_proto", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:wire", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -378,9 +385,9 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only @@ -394,6 +401,7 @@ filegroup( ), visibility = ["//pkg:__pkg__"], ) + filegroup( name = "test_utils", srcs = glob( diff --git a/upb/mini_descriptor/BUILD b/upb/mini_descriptor/BUILD index 1857b9c338..b1932ead98 100644 --- a/upb/mini_descriptor/BUILD +++ b/upb/mini_descriptor/BUILD @@ -60,7 +60,6 @@ cc_test( ":internal", ":mini_descriptor", "//:protobuf", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:message_accessors", @@ -68,6 +67,8 @@ cc_test( "//upb:port", "//upb:wire", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -81,9 +82,9 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/mini_table/BUILD b/upb/mini_table/BUILD index 71de9f2b5d..221e87be83 100644 --- a/upb/mini_table/BUILD +++ b/upb/mini_table/BUILD @@ -82,11 +82,12 @@ cc_test( name = "compat_test", srcs = ["compat_test.cc"], deps = [ - "@com_google_googletest//:gtest_main", "//upb:mini_table_compat", "//upb/test:test_messages_proto2_upb_minitable", "//upb/test:test_messages_proto3_upb_minitable", "//upb/test:test_upb_proto", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -100,9 +101,9 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/port/BUILD b/upb/port/BUILD index fe20c085e5..db3a91f549 100644 --- a/upb/port/BUILD +++ b/upb/port/BUILD @@ -45,8 +45,8 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/reflection/BUILD b/upb/reflection/BUILD index 5854704bf6..e42ebda23b 100644 --- a/upb/reflection/BUILD +++ b/upb/reflection/BUILD @@ -176,7 +176,6 @@ cc_test( ], deps = [ ":descriptor_upb_proto", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:hash", "//upb:mem", @@ -184,6 +183,8 @@ cc_test( "//upb:reflection", "//upb:reflection_internal", "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -223,8 +224,8 @@ filegroup( exclude = ["stage0/**"], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/test/BUILD b/upb/test/BUILD index 186dacd37c..493a51eb11 100644 --- a/upb/test/BUILD +++ b/upb/test/BUILD @@ -179,8 +179,9 @@ cc_test( deps = [ ":proto3_test_upb_proto", ":proto3_test_upb_proto_reflection", - "@com_google_googletest//:gtest_main", "//upb:reflection", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -191,10 +192,11 @@ cc_test( deps = [ ":editions_test_upb_c_proto", ":editions_test_upb_proto_reflection", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:reflection", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -207,11 +209,12 @@ cc_test( ":test_cpp_upb_proto_reflection", ":timestamp_upb_proto", ":timestamp_upb_proto_reflection", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:json", "//upb:port", "//upb:reflection", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -225,11 +228,12 @@ cc_test( ":test_messages_proto2_upb_proto", ":test_messages_proto3_upb_proto", ":test_upb_proto", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:mem", "//upb:message", "//upb:port", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -243,8 +247,9 @@ cc_test( ":proto3_test_upb_proto", ":test_messages_proto2_upb_minitable", ":test_upb_proto", - "@com_google_googletest//:gtest_main", "//upb:mini_table", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -296,6 +301,7 @@ cc_test( srcs = ["test_import_empty_srcs.cc"], deps = [ ":test_import_empty_srcs_upb_minitable_proto", + "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", ], ) @@ -311,6 +317,7 @@ filegroup( ), visibility = ["//pkg:__pkg__"], ) + filegroup( name = "test_utils", srcs = glob( diff --git a/upb/text/BUILD b/upb/text/BUILD index 7bc0953946..6a1a97c6eb 100644 --- a/upb/text/BUILD +++ b/upb/text/BUILD @@ -38,8 +38,8 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only diff --git a/upb/util/BUILD b/upb/util/BUILD index e299780ec5..e43b23959c 100644 --- a/upb/util/BUILD +++ b/upb/util/BUILD @@ -67,12 +67,13 @@ cc_test( ":def_to_proto_test_upb_proto", ":def_to_proto_test_upb_proto_reflection", "//:protobuf", - "@com_google_googletest//:gtest_main", "//upb:descriptor_upb_proto_reflection", "//upb:mem", "//upb:reflection", "//upb/test:parse_text_proto", "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -83,7 +84,7 @@ cc_test( # tags = ["clang_only"], # deps = [ # ":def_to_proto_test_lib", -# "@com_google_googletest//:gtest_main", +# "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", # "//testing/fuzzing:fuzztest", # ], # ) @@ -130,13 +131,14 @@ cc_test( ":required_fields", ":required_fields_test_upb_proto", ":required_fields_test_upb_proto_reflection", - "@com_google_googletest//:gtest_main", "//upb:base", "//upb:json", "//upb:mem", "//upb:reflection", "//upb:reflection_internal", "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -161,10 +163,11 @@ cc_test( srcs = ["compare_test.cc"], deps = [ ":compare", - "@com_google_googletest//:gtest_main", "//upb:port", "//upb:wire_reader", "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -193,6 +196,7 @@ filegroup( ), visibility = ["//pkg:__pkg__"], ) + filegroup( name = "test_utils", srcs = glob( diff --git a/upb/wire/BUILD b/upb/wire/BUILD index 5130a711cd..56b8927cf5 100644 --- a/upb/wire/BUILD +++ b/upb/wire/BUILD @@ -26,6 +26,7 @@ cc_library( deps = [ ":eps_copy_input_stream", ":reader", + "//third_party/utf8_range", "//upb:base", "//upb:hash", "//upb:mem", @@ -37,7 +38,6 @@ cc_library( "//upb:port", "//upb/mem:internal", "//upb/mini_table:internal", - "//third_party/utf8_range", ], ) @@ -75,8 +75,9 @@ cc_test( srcs = ["eps_copy_input_stream_test.cc"], deps = [ ":eps_copy_input_stream", - "@com_google_googletest//:gtest_main", "//upb:mem", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", ], ) @@ -90,9 +91,9 @@ filegroup( ], ), visibility = [ - "//upb/cmake:__pkg__", "//python/dist:__pkg__", - ] + "//upb/cmake:__pkg__", + ], ) # end:github_only