xref: /aosp_15_r20/external/grpc-grpc/third_party/upb/upb/json/BUILD (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1# TODO: describe this package.
2
3load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
4load(
5    "//bazel:upb_proto_library.bzl",
6    "upb_c_proto_library",
7    "upb_proto_reflection_library",
8)
9
10# begin:google_only
11# package(default_applicable_licenses = ["//upb:license"])
12# end:google_only
13
14cc_library(
15    name = "json",
16    srcs = [
17        "decode.c",
18        "encode.c",
19    ],
20    hdrs = [
21        "decode.h",
22        "encode.h",
23    ],
24    copts = UPB_DEFAULT_COPTS,
25    visibility = ["//visibility:public"],
26    deps = [
27        "//upb:base",
28        "//upb:mem",
29        "//upb:message",
30        "//upb:mini_table",
31        "//upb:port",
32        "//upb:reflection",
33        "//upb:wire",
34        "//upb/lex",
35    ],
36)
37
38cc_test(
39    name = "decode_test",
40    srcs = ["decode_test.cc"],
41    deps = [
42        ":json",
43        ":struct_upb_proto",
44        ":test_upb_proto",
45        ":test_upb_proto_reflection",
46        "//upb:base",
47        "//upb:mem",
48        "//upb:reflection",
49        "@com_google_googletest//:gtest",
50        "@com_google_googletest//:gtest_main",
51    ],
52)
53
54cc_test(
55    name = "encode_test",
56    srcs = ["encode_test.cc"],
57    deps = [
58        ":json",
59        ":struct_upb_proto",
60        ":test_upb_proto",
61        ":test_upb_proto_reflection",
62        "//upb:base",
63        "//upb:mem",
64        "//upb:reflection",
65        "@com_google_googletest//:gtest",
66        "@com_google_googletest//:gtest_main",
67    ],
68)
69
70proto_library(
71    name = "test_proto",
72    testonly = 1,
73    srcs = ["test.proto"],
74    deps = ["//:struct_proto"],
75)
76
77upb_c_proto_library(
78    name = "test_upb_proto",
79    testonly = 1,
80    deps = [":test_proto"],
81)
82
83upb_proto_reflection_library(
84    name = "test_upb_proto_reflection",
85    testonly = 1,
86    deps = [":test_proto"],
87)
88
89# TODO: This target arguably belongs in //google/protobuf/BUILD
90upb_c_proto_library(
91    name = "struct_upb_proto",
92    testonly = 1,
93    deps = ["//:struct_proto"],
94)
95
96# begin:google_only
97# cc_test(
98#     name = "fuzz_test",
99#     srcs = ["fuzz_test.cc"],
100#     deps = [
101#         ":json",
102#         ":test_upb_proto",
103#         ":test_upb_proto_reflection",
104#         "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main",
105#         "//testing/fuzzing:fuzztest",
106#         "//upb:base",
107#         "//upb:mem",
108#         "//upb:message",
109#         "//upb:mini_table",
110#         "//upb:reflection",
111#     ],
112# )
113# end:google_only
114
115# begin:github_only
116filegroup(
117    name = "test_srcs",
118    srcs = glob(
119        [
120            "**/*test.cc",
121        ],
122    ),
123    visibility = ["//pkg:__pkg__"],
124)
125
126filegroup(
127    name = "test_utils",
128    srcs = glob(
129        [
130            "**/*test.proto",
131        ],
132    ),
133    visibility = ["//pkg:__pkg__"],
134)
135# end:github_only
136