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