1# Copyright (c) 2009-2023, Google LLC 2# All rights reserved. 3# 4# Use of this source code is governed by a BSD-style 5# license that can be found in the LICENSE file or at 6# https://developers.google.com/open-source/licenses/bsd 7 8load( 9 "//upb/bazel:build_defs.bzl", 10 "UPB_DEFAULT_COPTS", 11) 12 13package(default_applicable_licenses = ["//:license"]) 14 15cc_library( 16 name = "mini_table", 17 srcs = [ 18 "extension_registry.c", 19 "message.c", 20 ], 21 hdrs = [ 22 "enum.h", 23 "extension.h", 24 "extension_registry.h", 25 "field.h", 26 "file.h", 27 "message.h", 28 "sub.h", 29 ], 30 copts = UPB_DEFAULT_COPTS, 31 visibility = ["//visibility:public"], 32 deps = [ 33 ":internal", 34 "//upb:base", 35 "//upb:mem", 36 "//upb:port", 37 "//upb/hash", 38 ], 39) 40 41cc_library( 42 name = "internal", 43 srcs = [ 44 "internal/message.c", 45 ], 46 hdrs = [ 47 "internal/enum.h", 48 "internal/extension.h", 49 "internal/field.h", 50 "internal/file.h", 51 "internal/message.h", 52 "internal/size_log2.h", 53 "internal/sub.h", 54 ], 55 copts = UPB_DEFAULT_COPTS, 56 visibility = ["//visibility:public"], 57 deps = [ 58 "//upb:base", 59 "//upb:mem", 60 "//upb:port", 61 "//upb/hash", 62 "//upb/message:types", 63 ], 64) 65 66cc_library( 67 name = "compat", 68 srcs = [ 69 "compat.c", 70 ], 71 hdrs = [ 72 "compat.h", 73 ], 74 copts = UPB_DEFAULT_COPTS, 75 visibility = ["//visibility:public"], 76 deps = [ 77 ":mini_table", 78 "//upb:base", 79 "//upb:mem", 80 "//upb:port", 81 "//upb/hash", 82 ], 83) 84 85cc_test( 86 name = "compat_test", 87 srcs = ["compat_test.cc"], 88 deps = [ 89 "//upb:mini_table_compat", 90 "//upb/test:test_messages_proto2_upb_minitable", 91 "//upb/test:test_messages_proto3_upb_minitable", 92 "//upb/test:test_upb_proto", 93 "@com_google_googletest//:gtest", 94 "@com_google_googletest//:gtest_main", 95 ], 96) 97 98filegroup( 99 name = "source_files", 100 srcs = glob( 101 [ 102 "**/*.c", 103 "**/*.h", 104 ], 105 ), 106 visibility = [ 107 "//python/dist:__pkg__", 108 "//upb/cmake:__pkg__", 109 ], 110) 111 112filegroup( 113 name = "test_srcs", 114 srcs = glob( 115 [ 116 "**/*test.cc", 117 ], 118 ), 119 visibility = ["//upb:__pkg__"], 120) 121