upb: clean up upb/json/BUILD
- Match build target names to their corresponding file names (remove stuttering)
- Replace a dep on (deprecated) :upb with a dep on :wire
- Mark :struct_upb_proto as testonly
- Group the cc_test targets together
PiperOrigin-RevId: 541408625
diff --git a/upb/json/BUILD b/upb/json/BUILD
index facb3aa..9a2ff40 100644
--- a/upb/json/BUILD
+++ b/upb/json/BUILD
@@ -1,9 +1,6 @@
# TODO(haberman): describe this package.
-load(
- "//bazel:build_defs.bzl",
- "UPB_DEFAULT_COPTS",
-)
+load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
load(
"//bazel:upb_proto_library.bzl",
"upb_proto_library",
@@ -27,7 +24,21 @@
"//:lex",
"//:port",
"//:reflection",
+ "//:wire",
+ ],
+)
+
+cc_test(
+ name = "decode_test",
+ srcs = ["decode_test.cc"],
+ deps = [
+ ":json",
+ ":struct_upb_proto",
+ ":test_upb_proto",
+ ":test_upb_proto_reflection",
+ "//:reflection",
"//:upb",
+ "@com_google_googletest//:gtest_main",
],
)
@@ -36,9 +47,9 @@
srcs = ["encode_test.cc"],
deps = [
":json",
- ":json_test_upb_proto",
- ":json_test_upb_proto_reflection",
":struct_upb_proto",
+ ":test_upb_proto",
+ ":test_upb_proto_reflection",
"//:reflection",
"//:upb",
"@com_google_googletest//:gtest_main",
@@ -46,39 +57,27 @@
)
proto_library(
- name = "json_test_proto",
+ name = "test_proto",
testonly = 1,
srcs = ["test.proto"],
deps = ["@com_google_protobuf//:struct_proto"],
)
upb_proto_library(
- name = "json_test_upb_proto",
+ name = "test_upb_proto",
testonly = 1,
- deps = [":json_test_proto"],
+ deps = [":test_proto"],
)
upb_proto_reflection_library(
- name = "json_test_upb_proto_reflection",
+ name = "test_upb_proto_reflection",
testonly = 1,
- deps = [":json_test_proto"],
+ deps = [":test_proto"],
)
-cc_test(
- name = "json_decode_test",
- srcs = ["decode_test.cc"],
- deps = [
- ":json",
- ":json_test_upb_proto",
- ":json_test_upb_proto_reflection",
- ":struct_upb_proto",
- "//:reflection",
- "//:upb",
- "@com_google_googletest//:gtest_main",
- ],
-)
-
+# TODO: This target arguably belongs in //google/protobuf/BUILD
upb_proto_library(
name = "struct_upb_proto",
+ testonly = 1,
deps = ["@com_google_protobuf//:struct_proto"],
)