Skip to content

Commit

Permalink
Split mini_descriptor into its own directory
Browse files Browse the repository at this point in the history
After this change, `mini_table` only has MiniTable definitions themselves.  Everything having to do with the MiniDescriptor wire format is in `mini_descriptor`.

Also rearranged some of the files in mini_table to have better structure for `internal/`.

This CL contains no functional change.

PiperOrigin-RevId: 543529112
  • Loading branch information
haberman authored and copybara-github committed Jun 26, 2023
1 parent b2e55ee commit 07f6b57
Show file tree
Hide file tree
Showing 69 changed files with 967 additions and 466 deletions.
128 changes: 90 additions & 38 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ cc_library(
":message_internal",
":port",
":wire",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
],
)

Expand Down Expand Up @@ -207,7 +207,7 @@ alias(

alias(
name = "mini_table_internal",
actual = "//upb/mini_table:mini_table_internal",
actual = "//upb/mini_table:internal",
visibility = ["//:friends"],
)

Expand All @@ -228,7 +228,17 @@ cc_library(
":hash",
":mem",
":port",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
],
)

cc_library(
name = "message_tagged_ptr",
hdrs = ["upb/message/tagged_ptr.h"],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:friends"],
deps = [
":port",
],
)

Expand All @@ -242,8 +252,8 @@ cc_library(
deps = [
":collections_internal",
":message_internal",
":mini_table_internal",
":port",
"//upb/mini_table:mini_table_internal",
],
)

Expand All @@ -261,13 +271,13 @@ cc_library(
deps = [
":collections_internal",
":eps_copy_input_stream",
":hash",
":message_internal",
":mini_table",
":port",
":upb",
":wire",
":wire_reader",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table:internal",
],
)

Expand All @@ -291,7 +301,7 @@ cc_library(
":upb",
":wire",
":wire_reader",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
],
)

Expand All @@ -311,7 +321,7 @@ cc_library(
":message_internal",
":port",
":upb",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
],
)

Expand All @@ -336,7 +346,10 @@ cc_test(
":message_accessors",
":port",
":upb",
"//upb/mini_table:mini_table_internal",
"//upb/mini_descriptor",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_table",
"//upb/test:test_messages_proto2_upb_proto",
"//upb/test:test_messages_proto3_upb_proto",
"//upb/test:test_upb_proto",
Expand All @@ -356,7 +369,9 @@ cc_test(
":message_promote",
":port",
":upb",
"//upb/mini_table:mini_table_internal",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_table",
"//upb/test:test_messages_proto2_upb_proto",
"//upb/test:test_messages_proto3_upb_proto",
"//upb/test:test_upb_proto",
Expand All @@ -374,7 +389,7 @@ cc_test(
":message_accessors",
":message_copy",
":upb",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
"//upb/test:test_messages_proto2_upb_proto",
"//upb/test:test_messages_proto3_upb_proto",
"//upb/test:test_upb_proto",
Expand All @@ -395,7 +410,7 @@ cc_library(
":message_internal",
":port",
":wire",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
],
)

Expand All @@ -421,7 +436,8 @@ cc_library(
":message_internal",
":upb",
":wire_internal",
"//upb/mini_table:mini_table_internal",
"//upb/mini_descriptor",
"//upb/mini_table",
],
)

Expand Down Expand Up @@ -460,11 +476,8 @@ cc_library(
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":base",
":descriptor_upb_proto",
":hash",
":reflection_internal",
"//upb/mini_table:mini_table_internal",
"//upb/mini_descriptor",
],
)

Expand Down Expand Up @@ -502,6 +515,18 @@ cc_library(
],
)

cc_library(
name = "message_rep_internal",
hdrs = [
"upb/message/internal/map_entry.h",
],
copts = UPB_DEFAULT_COPTS,
deps = [
":base",
":hash",
],
)

cc_library(
name = "collections_internal",
srcs = [
Expand All @@ -525,8 +550,10 @@ cc_library(
":hash",
":mem",
":message_internal",
":message_rep_internal",
":message_tagged_ptr",
":port",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
],
)

Expand Down Expand Up @@ -630,7 +657,10 @@ bootstrap_cc_library(
":message_accessors",
":port",
":upb",
"//upb/mini_table:mini_table_internal",
"//upb/mini_descriptor",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_table",
],
)

Expand Down Expand Up @@ -811,7 +841,7 @@ cc_library(
":message_internal",
":port",
":wire_internal",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
],
)

Expand All @@ -837,14 +867,14 @@ cc_library(
":base",
":collections_internal",
":eps_copy_input_stream",
":hash",
":mem_internal",
":message_accessors_internal",
":message_internal",
":message_rep_internal",
":port",
":wire_reader",
":wire_types",
"//upb/mini_table:mini_table_internal",
"//upb/mini_table",
"@utf8_range",
],
)
Expand Down Expand Up @@ -937,14 +967,15 @@ cc_binary(
linkstatic = 1,
visibility = ["//visibility:public"],
deps = [
"//:collections",
"//:collections_split64",
"//:mem",
"//:message",
"//:message_accessors",
"//:message_split64",
"//:mini_table",
"//:port",
":collections",
":collections_split64",
":mem",
":message",
":message_accessors",
":message_split64",
":mini_table",
":port",
"//upb/mini_descriptor",
],
)

Expand All @@ -968,16 +999,22 @@ upb_amalgamation(
":hash",
":lex",
":mem_internal",
"//upb/mini_table:mini_table_internal",
":message_accessors",
":message_internal",
":message_rep_internal",
":message_tagged_ptr",
":port",
":reflection",
":reflection_internal",
":reflection",
":upb",
":wire_internal",
":wire_reader",
":wire_types",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_descriptor:mini_descriptor",
"//upb/mini_table:internal",
"//upb/mini_table:mini_table",
],
strip_import_prefix = ["src"],
)
Expand All @@ -999,8 +1036,8 @@ upb_amalgamation(
libs = [
":base",
":collections_internal",
":descriptor_upb_proto",
":descriptor_upb_proto_reflection",
":descriptor_upb_proto",
":eps_copy_input_stream",
":fastdecode",
":generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
Expand All @@ -1010,14 +1047,20 @@ upb_amalgamation(
":mem_internal",
":message_accessors",
":message_internal",
"//upb/mini_table:mini_table_internal",
":message_rep_internal",
":message_tagged_ptr",
":port",
":reflection",
":reflection_internal",
":reflection",
":upb",
":wire_internal",
":wire_reader",
":wire_types",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_descriptor:mini_descriptor",
"//upb/mini_table:internal",
"//upb/mini_table:mini_table",
],
prefix = "php-",
strip_import_prefix = ["src"],
Expand Down Expand Up @@ -1051,14 +1094,20 @@ upb_amalgamation(
":mem_internal",
":message_accessors",
":message_internal",
"//upb/mini_table:mini_table_internal",
":message_rep_internal",
":message_tagged_ptr",
":port",
":reflection",
":reflection_internal",
":reflection",
":upb",
":wire_internal",
":wire_reader",
":wire_types",
"//upb/mini_descriptor:encode_internal",
"//upb/mini_descriptor:internal",
"//upb/mini_descriptor:mini_descriptor",
"//upb/mini_table:internal",
"//upb/mini_table:mini_table",
],
prefix = "ruby-",
strip_import_prefix = ["src"],
Expand Down Expand Up @@ -1100,7 +1149,10 @@ pkg_files(
"upb/**/*.hpp",
"upb/**/*.inc",
],
exclude = ["upb/**/conformance_upb.c"],
exclude = [
"upb/**/conformance_upb.c",
"upb/reflection/stage0/**/*",
],
),
strip_prefix = "",
visibility = ["//python/dist:__pkg__"],
Expand Down
1 change: 1 addition & 0 deletions cmake/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ sh_test(
":copy_protos",
":gen_cmakelists",
"//:cmake_files",
"//upb/mini_descriptor:cmake_files",
"//upb/mini_table:cmake_files",
"@utf8_range//:utf8_range_srcs",
],
Expand Down
1 change: 0 additions & 1 deletion protos/protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "upb/mem/arena.h"
#include "upb/message/copy.h"
#include "upb/message/extension_internal.h"
#include "upb/mini_table/types.h"
#include "upb/upb.hpp"
#include "upb/wire/decode.h"
#include "upb/wire/encode.h"
Expand Down
1 change: 0 additions & 1 deletion protos/repeated_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "upb/collections/array_internal.h"
#include "upb/mem/arena.h"
#include "upb/message/copy.h"
#include "upb/mini_table/types.h"

// Must be last:
#include "upb/port/def.inc"
Expand Down
1 change: 0 additions & 1 deletion protos/repeated_field_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "upb/collections/array.h"
#include "upb/mem/arena.h"
#include "upb/message/copy.h"
#include "upb/mini_table/types.h"

// Must be last:
#include "upb/port/def.inc"
Expand Down
3 changes: 3 additions & 0 deletions python/dist/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ pkg_tar(
"//:LICENSE",
"//:upb_source_files",
"//python:message_extension",
"//upb/mini_descriptor:internal_source_files",
"//upb/mini_descriptor:source_files",
"//upb/mini_table:internal_source_files",
"//upb/mini_table:source_files",
"//upb/util:util_source_files",
"@com_google_protobuf//python:python_source_files",
Expand Down
2 changes: 1 addition & 1 deletion python/dist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def GetVersion():
'google._upb._message',
glob.glob('google/protobuf/*.c')
+ glob.glob('python/*.c')
+ glob.glob('upb/**/*.c')
+ glob.glob('upb/**/*.c', recursive=True)
+ glob.glob('utf8_range/*.c'),
include_dirs=[current_dir, os.path.join(current_dir, 'utf8_range')],
language='c',
Expand Down
2 changes: 1 addition & 1 deletion upb/collections/map_sorter_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "upb/collections/map_internal.h"
#include "upb/message/extension_internal.h"
#include "upb/mini_table/message_internal.h"
#include "upb/message/internal/map_entry.h"

// Must be last.
#include "upb/port/def.inc"
Expand Down
Loading

0 comments on commit 07f6b57

Please sign in to comment.