upb: dedup the libraries

Remove array.h and map.h as hdrs from :collections_internal
Remove alloc.h and arena.h as hdrs from :mem_internal (and add them to :mem)
Remove common.h and decode.h and encode.h as hdrs from :wire_internal
Lock down the visibility of :wire_internal to upb-only
Merge :mini_descriptor_encode_internal into :mini_descriptor_internal
PiperOrigin-RevId: 558235138
pull/13675/head^2
Eric Salo 2 years ago committed by Copybara-Service
parent e49f999de9
commit cc41a8bed3
  1. 12
      BUILD
  2. 2
      protos/BUILD
  3. 1
      protos/protos.cc
  4. 1
      python/BUILD
  5. 3
      python/message.c
  6. 1
      upb/base/BUILD
  7. 4
      upb/collections/BUILD
  8. 8
      upb/mem/BUILD
  9. 8
      upb/message/BUILD
  10. 1
      upb/message/accessors.c
  11. 1
      upb/message/accessors_test.cc
  12. 1
      upb/message/promote.c
  13. 1
      upb/message/promote_test.cc
  14. 23
      upb/mini_descriptor/BUILD
  15. 1
      upb/text/BUILD
  16. 10
      upb/wire/BUILD
  17. 1
      upb/wire/decode.h
  18. 1
      upb/wire/encode.h

12
BUILD

@ -132,6 +132,7 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":base",
":collections",
":collections_internal",
":mem",
":message_accessors",
@ -139,6 +140,7 @@ cc_library(
":message_internal",
":mini_descriptor",
":mini_table",
":wire",
":wire_internal",
],
)
@ -288,7 +290,6 @@ bootstrap_cc_library(
":message",
":message_accessors",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":port",
@ -425,12 +426,6 @@ alias(
visibility = ["//visibility:public"],
)
alias(
name = "mini_descriptor_encode_internal",
actual = "//upb/mini_descriptor:encode_internal",
visibility = ["//:__subpackages__"],
)
alias(
name = "mini_descriptor_internal",
actual = "//upb/mini_descriptor:internal",
@ -562,7 +557,6 @@ upb_amalgamation(
":message_tagged_ptr",
":message_typedef",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":mini_table_internal",
@ -610,7 +604,6 @@ upb_amalgamation(
":message_tagged_ptr",
":message_typedef",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":mini_table_internal",
@ -659,7 +652,6 @@ upb_amalgamation(
":message_tagged_ptr",
":message_typedef",
":mini_descriptor",
":mini_descriptor_encode_internal",
":mini_descriptor_internal",
":mini_table",
":mini_table_internal",

@ -50,6 +50,7 @@ cc_library(
":protos",
":protos_traits",
"//:base",
"//:collections",
"//:collections_internal",
"//:mem",
"//:message_copy",
@ -82,7 +83,6 @@ cc_library(
"//:mini_table",
"//:upb",
"//:wire",
"//:wire_internal",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",

@ -46,7 +46,6 @@
#include "upb/mini_table/extension.h"
#include "upb/mini_table/extension_registry.h"
#include "upb/mini_table/message.h"
#include "upb/wire/common.h"
#include "upb/wire/decode.h"
#include "upb/wire/encode.h"

@ -245,7 +245,6 @@ py_extension(
"//:text",
"//:upb",
"//:wire",
"//:wire_internal",
"//:wire_reader",
"//:wire_types",
"//upb/util:compare",

@ -40,7 +40,6 @@
#include "upb/reflection/message.h"
#include "upb/text/encode.h"
#include "upb/util/required_fields.h"
#include "upb/wire/common.h"
static const upb_MessageDef* PyUpb_MessageMeta_GetMsgdef(PyObject* cls);
static PyObject* PyUpb_MessageMeta_GetAttr(PyObject* self, PyObject* name);
@ -1104,7 +1103,7 @@ static PyObject* PyUpb_Message_CheckCalledFromGeneratedFile(
PyObject* unused, PyObject* unused_arg) {
PyErr_SetString(
PyExc_TypeError,
"Descriptors cannot not be created directly.\n"
"Descriptors cannot be created directly.\n"
"If this call came from a _pb2.py file, your generated code is out of "
"date and must be regenerated with protoc >= 3.19.0.\n"
"If you cannot immediately regenerate your protos, some other possible "

@ -38,7 +38,6 @@ cc_library(
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":internal",
"//:port",
],
)

@ -45,15 +45,15 @@ cc_library(
name = "internal",
srcs = [
"array.c",
"array.h",
"map.c",
"map.h",
"map_sorter.c",
],
hdrs = [
"array.h",
"internal/array.h",
"internal/map.h",
"internal/map_sorter.h",
"map.h",
"map_gencode_util.h",
"message_value.h",
],

@ -43,16 +43,18 @@ cc_library(
name = "internal",
srcs = [
"alloc.c",
"alloc.h",
"arena.c",
"arena.h",
],
hdrs = [
"alloc.h",
"arena.h",
"internal/arena.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__pkg__"],
deps = ["//:port"],
deps = [
"//:port",
],
)
cc_test(

@ -44,13 +44,13 @@ cc_library(
deps = [
":internal",
"//:base",
"//:collections",
"//:collections_internal",
"//:eps_copy_input_stream",
"//:mini_table",
"//:mini_table_internal",
"//:port",
"//:wire",
"//:wire_internal",
"//:wire_reader",
],
)
@ -146,6 +146,7 @@ cc_library(
":internal",
":typedef",
"//:base",
"//:collections",
"//:collections_internal",
"//:eps_copy_input_stream",
"//:hash",
@ -153,7 +154,6 @@ cc_library(
"//:mini_table",
"//:port",
"//:wire",
"//:wire_internal",
"//:wire_reader",
],
)
@ -234,13 +234,11 @@ cc_test(
"//:base",
"//:collections",
"//:mini_descriptor",
"//:mini_descriptor_encode_internal",
"//:mini_descriptor_internal",
"//:mini_table",
"//:port",
"//:upb",
"//:wire",
"//:wire_internal",
"//upb/test:test_messages_proto2_upb_proto",
"//upb/test:test_messages_proto3_upb_proto",
"//upb/test:test_upb_proto",
@ -281,13 +279,11 @@ cc_test(
":promote",
"//:base",
"//:collections",
"//:mini_descriptor_encode_internal",
"//:mini_descriptor_internal",
"//:mini_table",
"//:port",
"//:upb",
"//:wire",
"//:wire_internal",
"//upb/test:test_messages_proto2_upb_proto",
"//upb/test:test_messages_proto3_upb_proto",
"//upb/test:test_upb_proto",

@ -35,7 +35,6 @@
#include "upb/collections/map.h"
#include "upb/message/message.h"
#include "upb/mini_table/field.h"
#include "upb/wire/common.h"
#include "upb/wire/decode.h"
#include "upb/wire/encode.h"
#include "upb/wire/eps_copy_input_stream.h"

@ -47,7 +47,6 @@
#include "upb/mini_descriptor/internal/encode.hpp"
#include "upb/mini_descriptor/internal/modifiers.h"
#include "upb/test/test.upb.h"
#include "upb/wire/common.h"
#include "upb/wire/decode.h"
// Must be last

@ -36,7 +36,6 @@
#include "upb/message/accessors.h"
#include "upb/message/message.h"
#include "upb/mini_table/field.h"
#include "upb/wire/common.h"
#include "upb/wire/decode.h"
#include "upb/wire/encode.h"
#include "upb/wire/eps_copy_input_stream.h"

@ -49,7 +49,6 @@
#include "upb/mini_descriptor/internal/modifiers.h"
#include "upb/test/test.upb.h"
#include "upb/upb.hpp"
#include "upb/wire/common.h"
#include "upb/wire/decode.h"
// Must be last

@ -32,35 +32,19 @@ cc_library(
name = "internal",
srcs = [
"internal/base92.c",
"internal/encode.c",
],
hdrs = [
"internal/base92.h",
"internal/decoder.h",
"internal/modifiers.h",
"internal/wire_constants.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
"//:base",
"//:base_internal",
"//:port",
],
)
cc_library(
name = "encode_internal",
srcs = [
"internal/encode.c",
],
hdrs = [
"internal/encode.h",
"internal/encode.hpp",
"internal/modifiers.h",
"internal/wire_constants.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
":internal",
"//:base",
"//:base_internal",
"//:port",
@ -72,7 +56,6 @@ cc_test(
srcs = ["internal/encode_test.cc"],
copts = UPB_DEFAULT_CPPOPTS,
deps = [
":encode_internal",
":internal",
":mini_descriptor",
"//:message_accessors_internal",

@ -36,6 +36,7 @@ cc_library(
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
"//:collections",
"//:collections_internal",
"//:eps_copy_input_stream",
"//:lex",

@ -27,7 +27,10 @@ load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
cc_library(
name = "wire",
srcs = [
],
hdrs = [
"common.h",
"decode.h",
"encode.h",
],
@ -45,15 +48,15 @@ cc_library(
cc_library(
name = "internal",
srcs = [
"common.h",
"decode.c",
"decode.h",
"decode_fast.c",
"encode.c",
"encode.h",
],
hdrs = [
"common.h",
"decode.h",
"decode_fast.h",
"encode.h",
"internal/common.h",
"internal/decode.h",
"internal/swap.h",
@ -66,6 +69,7 @@ cc_library(
":types",
"//:base",
"//:collections_internal",
"//:mem",
"//:mem_internal",
"//:message_accessors_internal",
"//:message_internal",

@ -36,6 +36,7 @@
#include "upb/mem/arena.h"
#include "upb/message/message.h"
#include "upb/mini_table/extension_registry.h"
#include "upb/wire/common.h"
// Must be last.
#include "upb/port/def.inc"

@ -34,6 +34,7 @@
#define UPB_WIRE_ENCODE_H_
#include "upb/message/message.h"
#include "upb/wire/common.h"
// Must be last.
#include "upb/port/def.inc"

Loading…
Cancel
Save