# Copyright (c) 2009-2021, Google LLC # All rights reserved. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd load("@rules_cc//cc:cc_test.bzl", "cc_test") load("@rules_cc//cc:defs.bzl", "cc_library") load("//bazel:proto_library.bzl", "proto_library") load( "//upb/bazel:copts.bzl", "UPB_DEFAULT_CPPOPTS", "UPB_DEFAULT_FEATURES", ) load( "//upb/bazel:upb_minitable_proto_library.bzl", "upb_minitable_proto_library", ) load( "//upb/bazel:upb_proto_library.bzl", "upb_c_proto_library", "upb_proto_reflection_library", ) package(default_applicable_licenses = ["//:license"]) cc_library( name = "parse_text_proto", testonly = 1, hdrs = ["parse_text_proto.h"], visibility = ["//upb:__subpackages__"], deps = [ "//src/google/protobuf", "@googletest//:gtest", ], ) proto_library( name = "empty_proto", srcs = ["empty.proto"], ) upb_proto_reflection_library( name = "empty_upb_proto_reflection", testonly = 1, deps = [":empty_proto"], ) proto_library( name = "proto3_test_proto", testonly = 1, srcs = ["proto3_test.proto"], deps = ["//:descriptor_proto"], ) upb_c_proto_library( name = "proto3_test_upb_proto", testonly = 1, deps = [":proto3_test_proto"], ) upb_proto_reflection_library( name = "proto3_test_upb_proto_reflection", testonly = 1, deps = [":proto3_test_proto"], ) proto_library( name = "test_proto", testonly = 1, srcs = ["test.proto"], visibility = ["//visibility:private"], ) upb_minitable_proto_library( name = "test_proto_upb_minitable", testonly = 1, visibility = ["//upb:__subpackages__"], deps = [":test_proto"], ) upb_c_proto_library( name = "test_upb_proto", testonly = 1, visibility = ["//upb:__subpackages__"], deps = [":test_proto"], ) proto_library( name = "editions_test_proto", testonly = 1, srcs = ["editions_test.proto"], option_deps = [ ":custom_options_proto", ":custom_options_unlinked_proto", ], deps = ["//:descriptor_proto"], ) upb_c_proto_library( name = "editions_test_upb_c_proto", testonly = 1, deps = [":editions_test_proto"], ) upb_minitable_proto_library( name = "editions_test_upb_minitable_proto", testonly = 1, visibility = ["//upb:__subpackages__"], deps = [":editions_test_proto"], ) upb_proto_reflection_library( name = "editions_test_upb_proto_reflection", testonly = 1, deps = [":editions_test_proto"], ) proto_library( name = "test_multiple_files_proto", testonly = 1, srcs = [ "test_multiple_files.proto", "test_multiple_files2.proto", ], ) upb_c_proto_library( name = "test_multiple_files_upb_c_proto", testonly = 1, deps = [":test_multiple_files_proto"], ) upb_minitable_proto_library( name = "test_multiple_files_upb_minitable_proto", testonly = 1, visibility = ["//upb:__subpackages__"], deps = [":test_multiple_files_proto"], ) proto_library( name = "test_cpp_proto", srcs = ["test_cpp.proto"], deps = ["//:timestamp_proto"], ) upb_c_proto_library( name = "test_cpp_upb_proto", deps = ["test_cpp_proto"], ) upb_proto_reflection_library( name = "test_cpp_upb_proto_reflection", deps = ["test_cpp_proto"], ) upb_minitable_proto_library( name = "test_messages_proto2_upb_minitable", testonly = 1, visibility = ["//upb:__subpackages__"], deps = ["//src/google/protobuf:test_messages_proto2_proto"], ) upb_minitable_proto_library( name = "test_messages_proto3_upb_minitable", testonly = 1, visibility = ["//upb:__subpackages__"], deps = ["//src/google/protobuf:test_messages_proto3_proto"], ) upb_c_proto_library( name = "test_messages_proto2_upb_proto", testonly = 1, visibility = ["//upb:__subpackages__"], deps = ["//src/google/protobuf:test_messages_proto2_proto"], ) upb_c_proto_library( name = "test_messages_proto3_upb_proto", testonly = 1, visibility = ["//upb:__subpackages__"], deps = ["//src/google/protobuf:test_messages_proto3_proto"], ) upb_c_proto_library( name = "timestamp_upb_proto", deps = ["//:timestamp_proto"], ) upb_proto_reflection_library( name = "timestamp_upb_proto_reflection", deps = ["//:timestamp_proto"], ) cc_library( name = "fuzz_util", testonly = 1, srcs = ["fuzz_util.cc"], hdrs = ["fuzz_util.h"], visibility = ["//upb:__subpackages__"], deps = [ "//upb/base", "//upb/mem", "//upb/mini_descriptor", "//upb/mini_table", "//upb/mini_table:internal", "//upb/port", ], ) cc_test( name = "proto3_test", srcs = ["proto3_test.cc"], copts = UPB_DEFAULT_CPPOPTS, features = UPB_DEFAULT_FEATURES, deps = [ ":proto3_test_upb_proto", ":proto3_test_upb_proto_reflection", "//upb/reflection", "@googletest//:gtest", "@googletest//:gtest_main", ], ) cc_test( name = "editions_test", srcs = ["editions_test.cc"], copts = UPB_DEFAULT_CPPOPTS, features = UPB_DEFAULT_FEATURES, deps = [ ":custom_options_upb_c_proto", ":editions_test_upb_c_proto", ":editions_test_upb_proto_reflection", "//upb/base", "//upb/mem", "//upb/message", "//upb/mini_table", "//upb/port", "//upb/reflection", "//upb/reflection:descriptor_upb_proto", "@googletest//:gtest", "@googletest//:gtest_main", ], ) cc_test( name = "length_prefixed_test", srcs = ["length_prefixed_test.cc"], copts = UPB_DEFAULT_CPPOPTS, features = UPB_DEFAULT_FEATURES, deps = [ ":test_messages_proto2_upb_minitable", ":test_messages_proto2_upb_proto", "//upb/base", "//upb/mem", "//upb/mem:internal", "//upb/message", "//upb/message:compare", "//upb/mini_table", "//upb/wire", "@googletest//:gtest", "@googletest//:gtest_main", ], ) cc_test( name = "test_cpp", srcs = ["test_cpp.cc"], copts = UPB_DEFAULT_CPPOPTS, features = UPB_DEFAULT_FEATURES, deps = [ ":test_cpp_upb_proto", ":test_cpp_upb_proto_reflection", ":timestamp_upb_proto", ":timestamp_upb_proto_reflection", "//upb/base", "//upb/json", "//upb/port", "//upb/reflection", "@googletest//:gtest", "@googletest//:gtest_main", ], ) cc_test( name = "test_generated_code", srcs = [ "test_generated_code.cc", ], deps = [ ":empty_upb_proto_reflection", ":test_messages_proto2_upb_proto", ":test_messages_proto3_upb_proto", ":test_upb_proto", "//upb/base", "//upb/mem", "//upb/message", "//upb/port", "//upb/wire", "@googletest//:gtest", "@googletest//:gtest_main", ], ) cc_test( name = "test_mini_table_oneof", srcs = [ "test_mini_table_oneof.cc", ], deps = [ ":empty_upb_proto_reflection", ":proto3_test_upb_proto", ":test_messages_proto2_upb_minitable", ":test_upb_proto", "//upb/mini_table", "@googletest//:gtest", "@googletest//:gtest_main", ], ) proto_library( name = "empty_srcs_proto", testonly = 1, srcs = [], deps = [":test_proto"], ) proto_library( name = "empty_srcs_2_proto", testonly = 1, srcs = [], deps = [":test_cpp_proto"], ) proto_library( name = "empty_srcs_3_proto", testonly = 1, srcs = [], deps = [ ":empty_srcs_2_proto", ":empty_srcs_proto", ], ) proto_library( name = "test_import_empty_srcs_proto", testonly = 1, srcs = ["test_import_empty_srcs.proto"], deps = [":empty_srcs_3_proto"], ) proto_library( name = "custom_options_unlinked_proto", testonly = 1, srcs = ["custom_options_unlinked.proto"], deps = ["//:descriptor_proto"], ) proto_library( name = "custom_options_proto", testonly = 1, srcs = ["custom_options.proto"], deps = ["//:descriptor_proto"], ) upb_c_proto_library( name = "custom_options_upb_c_proto", testonly = 1, deps = [":custom_options_proto"], ) upb_minitable_proto_library( name = "custom_options_upb_minitable_proto", testonly = 1, visibility = ["//upb:__subpackages__"], deps = [":custom_options_proto"], ) upb_proto_reflection_library( name = "custom_options_upb_proto_reflection", testonly = 1, deps = [":custom_options_proto"], ) upb_minitable_proto_library( name = "test_import_empty_srcs_upb_minitable_proto", testonly = 1, deps = [":test_import_empty_srcs_proto"], ) upb_c_proto_library( name = "test_import_empty_srcs_upb_proto", testonly = 1, deps = [":test_import_empty_srcs_proto"], ) cc_test( name = "test_import_empty_srcs", srcs = ["test_import_empty_srcs.cc"], deps = [ ":test_import_empty_srcs_upb_minitable_proto", "@googletest//:gtest", "@googletest//:gtest_main", ], ) filegroup( name = "test_srcs", srcs = glob( [ "**/*test.cc", "**/test_*.cc", ], ), visibility = ["//upb:__pkg__"], ) filegroup( name = "test_util", testonly = 1, srcs = [ "fuzz_util.cc", "fuzz_util.h", "parse_text_proto.h", ], visibility = ["//upb:__pkg__"], ) filegroup( name = "test_protos", srcs = glob( [ "**/*.proto", ], exclude = [ "custom_options_unlinked.proto", ], ), visibility = ["//upb:__pkg__"], )