Skip to content

Commit

Permalink
- All of reflection now lives in upb/reflection/
Browse files Browse the repository at this point in the history
- Each def type has its own .c file and its own .h file
- Functions that require a builder context are declared in def_builder.h
- The mini descriptor encoders have also been pulled into upb/reflection/
- upb/def.h, upb/def.hpp, upb/reflection.h, and upb/reflection.hpp are now deprecated stubs that point to the new headers

PiperOrigin-RevId: 474459500
  • Loading branch information
ericsalo authored and copybara-github committed Sep 15, 2022
1 parent cbba1fb commit 0076500
Show file tree
Hide file tree
Showing 44 changed files with 5,825 additions and 4,297 deletions.
98 changes: 72 additions & 26 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ cc_library(
hdrs = [
"upb/msg_internal.h",
],
visibility = ["//:__subpackages__"],
deps = [
":extension_registry",
":port",
Expand Down Expand Up @@ -333,9 +334,7 @@ cc_library(
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":descriptor_upb_proto",
":reflection",
":table_internal",
],
)

Expand Down Expand Up @@ -372,29 +371,57 @@ cc_library(
],
)

# TODO(b/232091617): Once we can delete the deprecated forwarding headers
# (= everything in upb/) we can move this build target down into reflection/
cc_library(
name = "reflection",
srcs = [
"upb/def.c",
"upb/internal/mini_descriptor.c",
"upb/internal/mini_descriptor.h",
"upb/mini_descriptor.c",
"upb/msg.h",
"upb/reflection.c",
"upb/reflection/common.h",
"upb/reflection/def_builder.c",
"upb/reflection/def_builder.h",
"upb/reflection/def_pool.c",
"upb/reflection/def_pool.h",
"upb/reflection/def_type.c",
"upb/reflection/def_type.h",
"upb/reflection/enum_def.c",
"upb/reflection/enum_def.h",
"upb/reflection/enum_value_def.c",
"upb/reflection/enum_value_def.h",
"upb/reflection/extension_range.c",
"upb/reflection/extension_range.h",
"upb/reflection/field_def.c",
"upb/reflection/field_def.h",
"upb/reflection/file_def.c",
"upb/reflection/file_def.h",
"upb/reflection/message.c",
"upb/reflection/message_def.c",
"upb/reflection/message_def.h",
"upb/reflection/method_def.c",
"upb/reflection/method_def.h",
"upb/reflection/mini_descriptor_encode.c",
"upb/reflection/oneof_def.c",
"upb/reflection/oneof_def.h",
"upb/reflection/service_def.c",
"upb/reflection/service_def.h",
],
hdrs = [
"upb/def.h",
"upb/def.hpp",
"upb/mini_descriptor.h",
"upb/reflection.h",
"upb/reflection.hpp",
"upb/reflection/def.h",
"upb/reflection/def.hpp",
"upb/reflection/message.h",
"upb/reflection/message.hpp",
"upb/reflection/mini_descriptor_encode.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":collections",
":descriptor_upb_proto",
":mini_table",
":mini_table_internal",
":port",
":table_internal",
":upb",
Expand Down Expand Up @@ -444,6 +471,25 @@ cc_library(

# Tests ########################################################################

cc_test(
name = "def_builder_test",
srcs = [
"upb/reflection/common.h",
"upb/reflection/def_builder.h",
"upb/reflection/def_builder_test.cc",
"upb/reflection/def_pool.h",
"upb/reflection/def_type.h",
],
deps = [
":descriptor_upb_proto",
":port",
":reflection",
":table_internal",
":upb",
"@com_google_googletest//:gtest_main",
],
)

cc_test(
name = "test_generated_code",
srcs = ["upb/test_generated_code.cc"],
Expand Down Expand Up @@ -621,14 +667,14 @@ cc_test(
srcs = ["upb/test_cpp.cc"],
copts = UPB_DEFAULT_CPPOPTS,
deps = [
":json",
":port",
":reflection",
":test_cpp_upb_proto",
":test_cpp_upb_proto_reflection",
":timestamp_upb_proto",
":timestamp_upb_proto_reflection",
"//:json",
"//:port",
"//:reflection",
"//:upb",
":upb",
"@com_google_googletest//:gtest_main",
],
)
Expand All @@ -638,9 +684,9 @@ cc_test(
srcs = ["upb/test_table.cc"],
copts = UPB_DEFAULT_CPPOPTS,
deps = [
"//:port",
"//:table_internal",
"//:upb",
":port",
":table_internal",
":upb",
"@com_google_googletest//:gtest_main",
],
)
Expand Down Expand Up @@ -678,13 +724,13 @@ cc_binary(
deps = [
":conformance_proto_upb",
":conformance_proto_upbdefs",
":json",
":port",
":reflection",
":test_messages_proto2_upbdefs",
":test_messages_proto3_upbdefs",
"//:json",
"//:port",
"//:reflection",
"//:textformat",
"//:upb",
":textformat",
":upb",
],
)

Expand Down Expand Up @@ -719,13 +765,13 @@ cc_binary(
deps = [
":conformance_proto_upb",
":conformance_proto_upbdefs",
":json",
":port",
":reflection",
":test_messages_proto2_upbdefs",
":test_messages_proto3_upbdefs",
"//:json",
"//:port",
"//:reflection",
"//:textformat",
"//:upb",
":textformat",
":upb",
],
)

Expand Down
Loading

0 comments on commit 0076500

Please sign in to comment.