Merge the protobuf and upb Bazel repos

A couple weeks ago we moved upb into the protobuf Git repo, and this change
continues the merger of the two repos by making them into a single Bazel repo.
This was mostly a matter of deleting upb's WORKSPACE file and fixing up a bunch
of references to reflect the new structure.

Most of the changes are pretty mechanical, but one thing that needed more
invasive changes was the Python script for generating CMakeLists.txt,
make_cmakelists.py. The WORKSPACE file it relied on no longer exists with this
change, so I updated it to hardcode the information it needed from that file.

PiperOrigin-RevId: 564810016
pull/13886/head
Adam Cozzette 1 year ago committed by Copybara-Service
parent f175757c1a
commit 7286ffceb2
  1. 2
      .bazelignore
  2. 4
      .github/workflows/test_python.yml
  3. 23
      .github/workflows/test_upb.yml
  4. 4
      BUILD.bazel
  5. 21
      WORKSPACE
  6. 2
      objectivec/BUILD.bazel
  7. 6
      php/BUILD.bazel
  8. 8
      python/BUILD.bazel
  9. 6
      python/README.md
  10. 2
      python/google/protobuf/internal/numpy/BUILD.bazel
  11. 2
      regenerate_stale_files.sh
  12. 8
      ruby/ext/google/protobuf_c/BUILD.bazel
  13. 2
      rust/aspects.bzl
  14. 2
      rust/upb_kernel/BUILD
  15. 2
      rust/upb_kernel/upb_api.c
  16. 2
      src/BUILD.bazel
  17. 7
      src/google/protobuf/BUILD.bazel
  18. 2
      src/google/protobuf/compiler/BUILD.bazel
  19. 110
      upb/BUILD
  20. 91
      upb/WORKSPACE
  21. 6
      upb/bazel/BUILD
  22. 2
      upb/bazel/amalgamation.bzl
  23. 6
      upb/bazel/build_defs.bzl
  24. 2
      upb/bazel/py_proto_library.bzl
  25. 18
      upb/bazel/upb_proto_library.bzl
  26. 2
      upb/bazel/workspace_deps.bzl
  27. 16
      upb/benchmarks/BUILD
  28. 18
      upb/benchmarks/benchmark.cc
  29. 36
      upb/cmake/BUILD.bazel
  30. 4
      upb/cmake/build_defs.bzl
  31. 98
      upb/cmake/make_cmakelists.py
  32. 2
      upb/cmake/staleness_test.py
  33. 8
      upb/docs/wrapping-upb.md
  34. 36
      upb/lua/BUILD.bazel
  35. 6
      upb/lua/def.c
  36. 4
      upb/lua/lua_proto_library.bzl
  37. 6
      upb/lua/main.c
  38. 16
      upb/lua/msg.c
  39. 2
      upb/lua/test_upb.lua
  40. 4
      upb/lua/upb.c
  41. 6
      upb/lua/upb.h
  42. 66
      upb/protos/BUILD
  43. 4
      upb/protos/bazel/BUILD
  44. 18
      upb/protos/bazel/upb_cc_proto_library.bzl
  45. 26
      upb/protos/protos.cc
  46. 14
      upb/protos/protos.h
  47. 2
      upb/protos/protos_extension_lock.cc
  48. 8
      upb/protos/protos_extension_lock_test.cc
  49. 4
      upb/protos/protos_internal.h
  50. 8
      upb/protos/protos_internal_test.cc
  51. 20
      upb/protos/repeated_field.h
  52. 14
      upb/protos/repeated_field_iterator.h
  53. 2
      upb/protos/repeated_field_iterator_test.cc
  54. 28
      upb/protos_generator/BUILD
  55. 16
      upb/protos_generator/gen_accessors.cc
  56. 4
      upb/protos_generator/gen_accessors.h
  57. 6
      upb/protos_generator/gen_enums.cc
  58. 2
      upb/protos_generator/gen_enums.h
  59. 6
      upb/protos_generator/gen_extensions.cc
  60. 2
      upb/protos_generator/gen_extensions.h
  61. 18
      upb/protos_generator/gen_messages.cc
  62. 2
      upb/protos_generator/gen_messages.h
  63. 20
      upb/protos_generator/gen_repeated_fields.cc
  64. 2
      upb/protos_generator/gen_repeated_fields.h
  65. 2
      upb/protos_generator/gen_utils.cc
  66. 4
      upb/protos_generator/names.cc
  67. 2
      upb/protos_generator/names.h
  68. 2
      upb/protos_generator/output.cc
  69. 30
      upb/protos_generator/protoc-gen-upb-protos.cc
  70. 18
      upb/protos_generator/tests/BUILD
  71. 2
      upb/protos_generator/tests/child_model.proto
  72. 2
      upb/protos_generator/tests/no_package_enum_user.proto
  73. 2
      upb/protos_generator/tests/test_extension.proto
  74. 14
      upb/protos_generator/tests/test_generated.cc
  75. 2
      upb/protos_generator/tests/test_model.proto
  76. 34
      upb/python/BUILD
  77. 16
      upb/python/convert.c
  78. 4
      upb/python/convert.h
  79. 18
      upb/python/descriptor.c
  80. 4
      upb/python/descriptor.h
  81. 8
      upb/python/descriptor_containers.c
  82. 2
      upb/python/descriptor_containers.h
  83. 14
      upb/python/descriptor_pool.c
  84. 124
      upb/python/dist/BUILD.bazel
  85. 16
      upb/python/dist/dist.bzl
  86. 8
      upb/python/extension_dict.c
  87. 2
      upb/python/extension_dict.h
  88. 12
      upb/python/map.c
  89. 4
      upb/python/map.h
  90. 24
      upb/python/message.c
  91. 4
      upb/python/message.h
  92. 8
      upb/python/pb_unit_tests/BUILD
  93. 12
      upb/python/pb_unit_tests/pyproto_test_wrapper.bzl
  94. 20
      upb/python/protobuf.c
  95. 6
      upb/python/protobuf.h
  96. 28
      upb/python/py_extension.bzl
  97. 8
      upb/python/repeated.c
  98. 4
      upb/python/repeated.h
  99. 12
      upb/python/unknown_fields.c
  100. 2
      upb/python/unknown_fields.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,6 +1,4 @@
# These are fetched as external repositories.
third_party/abseil-cpp
third_party/googletest
# upb is its own Bazel repository for now.
upb/
_build/

@ -20,7 +20,7 @@ jobs:
version: [ "3.7", "3.8", "3.9", "3.10" ]
include:
- type: Pure
targets: //python/... @upb//python/... //python:python_version
targets: //python/... //upb/python/... //python:python_version
flags: --define=use_fast_cpp_protos=false
- type: C++
targets: //python/... //python:python_version
@ -57,7 +57,7 @@ jobs:
version: [ "3.10" ]
include:
- type: Pure
targets: //python/... @upb//python/... //python:python_version
targets: //python/... //upb/python/... //python:python_version
- type: C++
targets: //python/... //python:python_version
flags: --define=use_fast_cpp_protos=true

@ -19,10 +19,10 @@ jobs:
config:
- { name: "Fastbuild" }
- { name: "Optimized", flags: "-c opt" }
- { name: "FastTable", flags: "--@upb//:fasttable_enabled=true" }
- { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-@upb//benchmarks:benchmark -@upb//python/..." }
- { name: "UBSAN", flags: "--config=ubsan -c dbg", exclude-targets: "-@upb//benchmarks:benchmark -@upb//python/... -@upb//lua/..." }
- { name: "32-bit", flags: "--copt=-m32 --linkopt=-m32", exclude-targets: "-@upb//benchmarks:benchmark -@upb//python/..." }
- { name: "FastTable", flags: "--//upb:fasttable_enabled=true" }
- { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//upb/benchmarks:benchmark -//upb/python/..." }
- { name: "UBSAN", flags: "--config=ubsan -c dbg", exclude-targets: "-//upb/benchmarks:benchmark -//upb/python/... -//upb/lua/..." }
- { name: "32-bit", flags: "--copt=-m32 --linkopt=-m32", exclude-targets: "-//upb/benchmarks:benchmark -//upb/python/..." }
# TODO: b/297027295 - Add 32-bit ASAN test
name: ${{ matrix.config.name }}
@ -39,7 +39,7 @@ jobs:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:04cd765285bc52cbbf51d66c8c66d8603579cf0f19cc42df26b09d2c270541fb
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: upb-bazel
bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 @upb//... ${{ matrix.config.flags }}
bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //upb/... ${{ matrix.config.flags }}
exclude-targets: ${{ matrix.config.exclude-targets }}
linux-gcc:
@ -58,12 +58,7 @@ jobs:
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:12.2-6.3.0-518b4fcd8d0ded2484c94f02e835526cacfdac2d"
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-gcc"
# The other test runs use the protobuf workspace. For this one let's
# cd into upb and use its workspace instead, to make sure we cover
# that use case.
bash: >-
cd upb &&
bazel test $BAZEL_FLAGS --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt //...
bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt //upb/...
windows:
strategy:
@ -80,7 +75,7 @@ jobs:
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-windows"
bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 @upb//upb/... @upb//upbc/... @upb//python/... @upb//protos/... @upb//protos_generator/...
bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/upb/... //upb/upbc/... //upb/python/... //upb/protos/... //upb/protos_generator/...
macos:
strategy:
@ -101,7 +96,7 @@ jobs:
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-macos"
bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} @upb//...
bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //upb/...
no-python:
strategy:
@ -123,4 +118,4 @@ jobs:
which python3 &&
mv `which python3` /tmp &&
! which python3 &&
bazel test $BAZEL_FLAGS --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 @upb//python/... -- -@upb//python/dist:source_wheel
bazel test $BAZEL_FLAGS --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //upb/python/... -- -//upb/python/dist:source_wheel

@ -294,13 +294,13 @@ alias(
alias(
name = "python_srcs",
actual = "//python:python_srcs",
visibility = ["@upb//:__subpackages__"],
visibility = ["//upb:__subpackages__"],
)
alias(
name = "python_test_srcs",
actual = "//python:python_test_srcs",
visibility = ["@upb//:__subpackages__"],
visibility = ["//upb:__subpackages__"],
)
alias(

@ -7,15 +7,6 @@ local_repository(
path = "examples",
)
# We will soon merge upb and protobuf into the same Bazel repository, but for
# now we depend on the separate Bazel repo in the upb/ directory. This is
# important to ensure that the CI tests exercise upb at head instead of relying
# on a stale version from protobuf_deps.bzl.
local_repository(
name = "upb",
path = "upb",
)
# Load common dependencies first to ensure we use the correct version
load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps")
@ -116,13 +107,13 @@ ruby_bundle(
gemfile = "//ruby:Gemfile",
)
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
load("//upb/bazel:workspace_deps.bzl", "upb_deps")
upb_deps()
http_archive(
name = "lua",
build_file = "@upb//bazel:lua.BUILD",
build_file = "//upb/bazel:lua.BUILD",
sha256 = "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b",
strip_prefix = "lua-5.2.4",
urls = [
@ -143,11 +134,11 @@ http_archive(
urls = ["https://github.com/googleapis/googleapis/archive/30ed2662a85403cbdeb9ea38df1e414a2a276b83.zip"],
strip_prefix = "googleapis-30ed2662a85403cbdeb9ea38df1e414a2a276b83",
sha256 = "4dfc28101127d22abd6f0f6308d915d490c4594c0cfcf7643769c446d6763a46",
build_file = "@upb//benchmarks:BUILD.googleapis",
build_file = "//upb/benchmarks:BUILD.googleapis",
patch_cmds = ["find google -type f -name BUILD.bazel -delete"],
)
load("@upb//bazel:system_python.bzl", "system_python")
load("//upb/bazel:system_python.bzl", "system_python")
system_python(
name = "system_python",
@ -158,9 +149,9 @@ load("@system_python//:pip.bzl", "pip_parse")
pip_parse(
name = "pip_deps",
requirements = "@upb//python:requirements.txt",
requirements = "//upb/python:requirements.txt",
requirements_overrides = {
"3.11": "@upb//python:requirements_311.txt",
"3.11": "//upb/python:requirements_311.txt",
},
)

@ -1,6 +1,6 @@
load("@rules_cc//cc:defs.bzl", "objc_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@upb//cmake:build_defs.bzl", "staleness_test")
load("//upb/cmake:build_defs.bzl", "staleness_test")
load("//conformance:defs.bzl", "conformance_test")
load(":defs.bzl", "objc_proto_camel_case_name")

@ -4,7 +4,7 @@
load("@rules_pkg//:mappings.bzl", "pkg_files", "pkg_filegroup", "strip_prefix")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@upb//cmake:build_defs.bzl", "staleness_test")
load("//upb/cmake:build_defs.bzl", "staleness_test")
load("//build_defs:internal_shell.bzl", "inline_sh_binary")
load("//conformance:defs.bzl", "conformance_test")
load("//:protobuf_version.bzl", "PROTOBUF_PHP_VERSION", "PROTOC_VERSION")
@ -85,14 +85,14 @@ conformance_test(
genrule(
name = "copy_php_amalgamation_h",
srcs = ["@upb//:php-upb.h"],
srcs = ["//upb:php-upb.h"],
outs = ["generated-in/ext/google/protobuf/php-upb.h"],
cmd = "cp $< $@",
)
genrule(
name = "copy_php_amalgamation_c",
srcs = ["@upb//:php-upb.c"],
srcs = ["//upb:php-upb.c"],
outs = ["generated-in/ext/google/protobuf/php-upb.c"],
cmd = "cp $< $@",
)

@ -46,7 +46,7 @@ internal_py_proto_library(
srcs_version = "PY2AND3",
visibility = [
"//:__pkg__",
"@upb//:__subpackages__",
"//upb:__subpackages__",
],
)
@ -152,7 +152,7 @@ py_library(
srcs_version = "PY2AND3",
visibility = [
"//:__pkg__",
"@upb//:__subpackages__",
"//upb:__subpackages__",
],
)
@ -170,7 +170,7 @@ py_library(
srcs_version = "PY3",
visibility = [
"//:__pkg__",
"@upb//:__subpackages__",
"//upb:__subpackages__",
],
)
@ -437,7 +437,7 @@ pkg_files(
"tox.ini",
],
strip_prefix = "",
visibility = ["@upb//:__subpackages__"],
visibility = ["//upb:__subpackages__"],
)
pkg_files(

@ -21,8 +21,8 @@ If for some reason you wish to build the packages directly from this repo, you
can use the following Bazel commands:
```
$ bazel build @upb//python/dist:source_wheel
$ bazel build @upb//python/dist:binary_wheel
$ bazel build //upb/python/dist:source_wheel
$ bazel build //upb/python/dist:binary_wheel
```
The binary wheel will build against whatever version of Python is installed on
@ -49,7 +49,7 @@ following values:
better performance than any of the previous backends, and it is now the
default. It is distributed in our PyPI packages, and requires no special
installation. The code for this module lives in
[@upb/python](https://github.com/protocolbuffers/upb/tree/main/python).
[upb/python](https://github.com/protocolbuffers/protobuf/tree/main/upb/python).
1. **cpp**: This extension module wraps the C++ protobuf library. It is
deprecated and is no longer released in our PyPI packages, however it is
still used in some legacy cases where apps want to perform zero-copy message

@ -18,6 +18,6 @@ internal_py_test(
],
visibility = [
"//python:__pkg__",
"@upb//python/pb_unit_tests:__pkg__",
"//upb/python/pb_unit_tests:__pkg__",
]
)

@ -18,7 +18,7 @@ ${BazelBin} test src/google/protobuf:well_known_types_staleness_test "$@" || ./b
${BazelBin} test objectivec:well_known_types_staleness_test "$@" || ./bazel-bin/objectivec/well_known_types_staleness_test --fix
${BazelBin} test php:test_amalgamation_staleness "$@" || ./bazel-bin/php/test_amalgamation_staleness --fix
${BazelBin} test ruby/ext/google/protobuf_c:test_amalgamation_staleness "$@" || ./bazel-bin/ruby/ext/google/protobuf_c/test_amalgamation_staleness --fix
(cd upb; ${BazelBin} test cmake:test_generated_files "$@" || ./bazel-bin/cmake/test_generated_files --fix)
${BazelBin} test upb/cmake:test_generated_files "$@" || ./bazel-bin/upb/cmake/test_generated_files --fix
# Generate C# code.
# This doesn't currently have Bazel staleness tests, but there's an existing

@ -1,6 +1,6 @@
load("@build_bazel_rules_apple//apple:apple_binary.bzl", "apple_binary")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@upb//cmake:build_defs.bzl", "staleness_test")
load("//upb/cmake:build_defs.bzl", "staleness_test")
package(default_visibility = ["//ruby:__subpackages__"])
@ -31,7 +31,7 @@ genrule(
name = "copy_sources",
srcs = PROTOBUF_C_SOURCES + [
"glue.c",
"@upb//:gen_ruby_amalgamation",
"//upb:gen_ruby_amalgamation",
],
outs = ["copy/%s" % src for src in PROTOBUF_C_SOURCES] + [
"copy/glue.c",
@ -155,14 +155,14 @@ pkg_files(
genrule(
name = "copy_ruby_amalgamation_h",
srcs = ["@upb//:ruby-upb.h"],
srcs = ["//upb:ruby-upb.h"],
outs = ["generated-in/ruby-upb.h"],
cmd = "cp $< $@",
)
genrule(
name = "copy_ruby_amalgamation_c",
srcs = ["@upb//:ruby-upb.c"],
srcs = ["//upb:ruby-upb.c"],
outs = ["generated-in/ruby-upb.c"],
cmd = "cp $< $@",
)

@ -9,7 +9,7 @@ load("@rules_rust//rust/private:providers.bzl", "CrateInfo", "DepInfo", "DepVari
# buildifier: disable=bzl-visibility
load("@rules_rust//rust/private:rustc.bzl", "rustc_compile_action")
load("@rules_rust//rust:defs.bzl", "rust_common")
load("@upb//bazel:upb_proto_library.bzl", "UpbWrappedCcInfo", "upb_proto_library_aspect")
load("//upb/bazel:upb_proto_library.bzl", "UpbWrappedCcInfo", "upb_proto_library_aspect")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
proto_common = proto_common_do_not_use

@ -8,6 +8,6 @@ cc_library(
"//rust:__subpackages__",
],
deps = [
"@upb//:upb",
"//upb",
],
)

@ -8,4 +8,4 @@
#define UPB_BUILD_API
#include "upb/mem/arena.h" // IWYU pragma: keep
#include "upb/upb/mem/arena.h" // IWYU pragma: keep

@ -4,7 +4,7 @@
# Most rules are under google/protobuf. This package exists for convenience.
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
load("@upb//cmake:build_defs.bzl", "staleness_test")
load("//upb/cmake:build_defs.bzl", "staleness_test")
load("//conformance:defs.bzl", "conformance_test")
pkg_files(

@ -5,7 +5,7 @@
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_proto_library", "cc_test")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@upb//cmake:build_defs.bzl", "staleness_test")
load("//upb/cmake:build_defs.bzl", "staleness_test")
load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS")
package(
@ -636,7 +636,6 @@ filegroup(
],
visibility = [
"//:__subpackages__",
"@upb//:__subpackages__",
],
)
@ -786,7 +785,7 @@ proto_library(
visibility = [
"//:__pkg__",
"//conformance:__pkg__",
"@upb//:__subpackages__",
"//upb:__subpackages__",
],
)
@ -797,7 +796,7 @@ proto_library(
visibility = [
"//:__pkg__",
"//conformance:__pkg__",
"@upb//:__subpackages__",
"//upb:__subpackages__",
],
deps = [
":any_proto",

@ -200,7 +200,7 @@ filegroup(
filegroup(
name = "plugin_proto_src",
srcs = ["plugin.proto"],
visibility = ["@upb//:__subpackages__"],
visibility = ["//upb:__subpackages__"],
)
exports_files(

@ -7,14 +7,14 @@
load("@rules_python//python:defs.bzl", "py_binary")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
load(
"//bazel:upb_proto_library.bzl",
"//upb/bazel:upb_proto_library.bzl",
"upb_proto_library_copts",
"upb_proto_reflection_library",
)
load(
"//upbc:bootstrap_compiler.bzl",
"//upb/upbc:bootstrap_compiler.bzl",
"bootstrap_cc_library",
"bootstrap_upb_proto_library",
)
@ -26,13 +26,13 @@ load(
# begin:github_only
load(
"//bazel:amalgamation.bzl",
"//upb/bazel:amalgamation.bzl",
"upb_amalgamation",
)
# end:github_only
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# package(default_applicable_licenses = ["//upb:license"])
#
# license(
# name = "license",
@ -49,7 +49,7 @@ exports_files(
"BUILD",
"WORKSPACE",
],
visibility = ["//cmake:__pkg__"],
visibility = ["//upb/cmake:__pkg__"],
)
config_setting(
@ -66,7 +66,7 @@ bool_flag(
config_setting(
name = "fasttable_enabled_setting",
flag_values = {"//:fasttable_enabled": "true"},
flag_values = {"//upb:fasttable_enabled": "true"},
visibility = ["//visibility:public"],
)
@ -109,7 +109,7 @@ cc_library(
hdrs = ["upb/generated_code_support.h"],
copts = UPB_DEFAULT_COPTS,
textual_hdrs = [
"//upb/port:inc",
"//upb/upb/port:inc",
],
visibility = ["//visibility:public"],
deps = [
@ -133,7 +133,7 @@ cc_library(
name = "generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
copts = UPB_DEFAULT_COPTS,
textual_hdrs = [
"//upb/port:inc",
"//upb/upb/port:inc",
],
visibility = ["//visibility:public"],
)
@ -146,7 +146,7 @@ cc_library(
],
copts = UPB_DEFAULT_COPTS,
textual_hdrs = [
"//upb/port:inc",
"//upb/upb/port:inc",
],
visibility = ["//visibility:public"],
deps = [
@ -164,16 +164,16 @@ bootstrap_upb_proto_library(
google3_src_files = ["net/proto2/proto/descriptor.proto"],
google3_src_rules = ["//net/proto2/proto:descriptor_proto_source"],
oss_src_files = ["google/protobuf/descriptor.proto"],
oss_src_rules = ["@com_google_protobuf//:descriptor_proto_srcs"],
oss_src_rules = ["//:descriptor_proto_srcs"],
oss_strip_prefix = "third_party/protobuf/github/bootstrap/src",
proto_lib_deps = ["@com_google_protobuf//:descriptor_proto"],
proto_lib_deps = ["//:descriptor_proto"],
visibility = ["//visibility:public"],
)
upb_proto_reflection_library(
name = "descriptor_upb_proto_reflection",
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:descriptor_proto"],
deps = ["//:descriptor_proto"],
)
# TODO(b/232091617): Once we can delete the deprecated forwarding headers
@ -273,196 +273,196 @@ bootstrap_cc_library(
alias(
name = "base",
actual = "//upb/base",
actual = "//upb/upb/base",
visibility = ["//visibility:public"],
)
alias(
name = "base_internal",
actual = "//upb/base:internal",
actual = "//upb/upb/base:internal",
visibility = ["//visibility:public"],
)
alias(
name = "collections",
actual = "//upb/collections",
actual = "//upb/upb/collections",
visibility = ["//visibility:public"],
)
alias(
name = "collections_internal",
actual = "//upb/collections:internal",
actual = "//upb/upb/collections:internal",
visibility = ["//visibility:public"],
)
alias(
name = "collections_split64",
actual = "//upb/collections:split64",
actual = "//upb/upb/collections:split64",
visibility = ["//visibility:public"],
)
alias(
name = "hash",
actual = "//upb/hash",
actual = "//upb/upb/hash",
visibility = ["//visibility:public"],
)
alias(
name = "json",
actual = "//upb/json",
actual = "//upb/upb/json",
visibility = ["//visibility:public"],
)
alias(
name = "lex",
actual = "//upb/lex",
actual = "//upb/upb/lex",
visibility = ["//visibility:public"],
)
alias(
name = "mem",
actual = "//upb/mem",
actual = "//upb/upb/mem",
visibility = ["//visibility:public"],
)
alias(
name = "mem_internal",
actual = "//upb/mem:internal",
visibility = ["//:__subpackages__"],
actual = "//upb/upb/mem:internal",
visibility = ["//upb:__subpackages__"],
)
alias(
name = "message",
actual = "//upb/message",
actual = "//upb/upb/message",
visibility = ["//visibility:public"],
)
alias(
name = "message_accessors",
actual = "//upb/message:accessors",
actual = "//upb/upb/message:accessors",
visibility = ["//visibility:public"],
)
alias(
name = "message_accessors_internal",
actual = "//upb/message:accessors_internal",
visibility = ["//:friends"],
actual = "//upb/upb/message:accessors_internal",
visibility = ["//upb:friends"],
)
alias(
name = "message_copy",
actual = "//upb/message:copy",
actual = "//upb/upb/message:copy",
visibility = ["//visibility:public"],
)
alias(
name = "message_internal",
actual = "//upb/message:internal",
actual = "//upb/upb/message:internal",
visibility = ["//visibility:public"],
)
alias(
name = "message_internal_types",
actual = "//upb/message:internal_types",
actual = "//upb/upb/message:internal_types",
visibility = ["//visibility:public"],
)
alias(
name = "message_promote",
actual = "//upb/message:promote",
actual = "//upb/upb/message:promote",
visibility = ["//visibility:public"],
)
alias(
name = "message_split64",
actual = "//upb/message:split64",
actual = "//upb/upb/message:split64",
visibility = ["//visibility:public"],
)
alias(
name = "message_tagged_ptr",
actual = "//upb/message:tagged_ptr",
visibility = ["//:friends"],
actual = "//upb/upb/message:tagged_ptr",
visibility = ["//upb:friends"],
)
alias(
name = "message_types",
actual = "//upb/message:types",
actual = "//upb/upb/message:types",
visibility = ["//visibility:public"],
)
alias(
name = "mini_descriptor",
actual = "//upb/mini_descriptor",
actual = "//upb/upb/mini_descriptor",
visibility = ["//visibility:public"],
)
alias(
name = "mini_descriptor_internal",
actual = "//upb/mini_descriptor:internal",
visibility = ["//:__subpackages__"],
actual = "//upb/upb/mini_descriptor:internal",
visibility = ["//upb:__subpackages__"],
)
alias(
name = "mini_table",
actual = "//upb/mini_table",
visibility = ["//:friends"],
actual = "//upb/upb/mini_table",
visibility = ["//upb:friends"],
)
# begin:google_only
# alias(
# name = "mini_table_compat",
# actual = "//upb/mini_table:compat",
# actual = "//upb/upb/mini_table:compat",
# compatible_with = ["//buildenv/target:non_prod"],
# visibility = ["//:friends"],
# visibility = ["//upb:friends"],
# )
# end:google_only
alias(
name = "mini_table_internal",
actual = "//upb/mini_table:internal",
actual = "//upb/upb/mini_table:internal",
visibility = ["//visibility:public"],
)
alias(
name = "port",
actual = "//upb/port",
actual = "//upb/upb/port",
visibility = ["//visibility:public"],
)
alias(
name = "text",
actual = "//upb/text",
actual = "//upb/upb/text",
visibility = ["//visibility:public"],
)
alias(
name = "wire",
actual = "//upb/wire",
actual = "//upb/upb/wire",
visibility = ["//visibility:public"],
)
alias(
name = "wire_internal",
actual = "//upb/wire:internal",
actual = "//upb/upb/wire:internal",
visibility = ["//visibility:public"],
)
alias(
name = "wire_reader",
actual = "//upb/wire:reader",
actual = "//upb/upb/wire:reader",
visibility = ["//visibility:public"],
)
alias(
name = "wire_types",
actual = "//upb/wire:types",
actual = "//upb/upb/wire:types",
visibility = ["//visibility:public"],
)
alias(
name = "eps_copy_input_stream",
actual = "//upb/wire:eps_copy_input_stream",
actual = "//upb/upb/wire:eps_copy_input_stream",
visibility = ["//visibility:public"],
)
@ -664,7 +664,7 @@ exports_files(
"third_party/lunit/console.lua",
"third_party/lunit/lunit.lua",
],
visibility = ["//lua:__pkg__"],
visibility = ["//upb/lua:__pkg__"],
)
filegroup(
@ -681,8 +681,8 @@ filegroup(
],
),
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
"//upb/cmake:__pkg__",
"//upb/python/dist:__pkg__",
]
)
# end:github_only
@ -720,7 +720,7 @@ filegroup(
# "upb_UnknownToMessage_Status",
# "upb_WireType",
# ],
# visibility = ["//:__subpackages__"],
# visibility = ["//upb:__subpackages__"],
# )
#
# end:google_only

@ -1,91 +0,0 @@
workspace(name = "upb")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//bazel:workspace_deps.bzl", "upb_deps")
local_repository(
name = "com_google_protobuf",
path = "..",
)
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
upb_deps()
load("@utf8_range//:workspace_deps.bzl", "utf8_range_deps")
utf8_range_deps()
http_archive(
name = "lua",
build_file = "//bazel:lua.BUILD",
sha256 = "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b",
strip_prefix = "lua-5.2.4",
urls = [
"https://mirror.bazel.build/www.lua.org/ftp/lua-5.2.4.tar.gz",
"https://www.lua.org/ftp/lua-5.2.4.tar.gz",
],
)
http_archive(
name = "com_github_google_benchmark",
urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"],
strip_prefix = "benchmark-0baacde3618ca617da95375e0af13ce1baadea47",
sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0",
)
http_archive(
name = "com_google_googleapis",
urls = ["https://github.com/googleapis/googleapis/archive/refs/heads/master.zip"],
build_file = "//benchmarks:BUILD.googleapis",
strip_prefix = "googleapis-master",
patch_cmds = ["find google -type f -name BUILD.bazel -delete"],
)
http_archive(
name = "com_google_absl",
sha256 = "e7fdfe0bed87702a22c5b73b6b5fe08bedd25f17d617e52df6061b0f47d480b0",
strip_prefix = "abseil-cpp-e6044634dd7caec2d79a13aecc9e765023768757",
urls = [
"https://github.com/abseil/abseil-cpp/archive/e6044634dd7caec2d79a13aecc9e765023768757.tar.gz"
],
)
http_archive(
name = "com_google_googletest",
sha256 = "730215d76eace9dd49bf74ce044e8daa065d175f1ac891cc1d6bb184ef94e565",
strip_prefix = "googletest-f53219cdcb7b084ef57414efea92ee5b71989558",
urls = [
"https://github.com/google/googletest/archive/f53219cdcb7b084ef57414efea92ee5b71989558.tar.gz" # 2023-03-16
],
)
load("@com_google_googletest//:googletest_deps.bzl", "googletest_deps")
googletest_deps()
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()
load("//bazel:system_python.bzl", "system_python")
system_python(
name = "system_python",
minimum_python_version = "3.7",
)
load("@system_python//:register.bzl", "register_system_python")
register_system_python()
load("@system_python//:pip.bzl", "pip_parse")
pip_parse(
name="pip_deps",
requirements = "//python:requirements.txt",
requirements_overrides = {
"3.11": "//python:requirements_311.txt",
},
)
load("@pip_deps//:requirements.bzl", "install_deps")
install_deps()

@ -9,20 +9,20 @@ load("@rules_python//python:defs.bzl", "py_binary")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# package(default_applicable_licenses = ["//upb:license"])
# end:google_only
licenses(["notice"])
exports_files(
["workspace_deps.bzl"],
visibility = ["//cmake:__pkg__"],
visibility = ["//upb/cmake:__pkg__"],
)
py_binary(
name = "amalgamate",
srcs = ["amalgamate.py"],
visibility = ["//:__pkg__"],
visibility = ["//upb:__pkg__"],
)
# py_proto_library() is private rule, only intended for internal use by upb.

@ -54,7 +54,7 @@ upb_amalgamation = rule(
"_amalgamator": attr.label(
executable = True,
cfg = "exec",
default = "//bazel:amalgamate",
default = "//upb/bazel:amalgamate",
),
"prefix": attr.string(
default = "",

@ -29,13 +29,13 @@ _DEFAULT_COPTS.extend([
# end:github_only
UPB_DEFAULT_CPPOPTS = select({
"//:windows": [],
"//upb:windows": [],
"//conditions:default": _DEFAULT_CPPOPTS,
})
UPB_DEFAULT_COPTS = select({
"//:windows": [],
"//:fasttable_enabled_setting": ["-std=gnu99", "-DUPB_ENABLE_FASTTABLE"],
"//upb:windows": [],
"//upb:fasttable_enabled_setting": ["-std=gnu99", "-DUPB_ENABLE_FASTTABLE"],
"//conditions:default": _DEFAULT_COPTS,
})

@ -116,7 +116,7 @@ _py_proto_library_aspect = aspect(
"_protoc": attr.label(
executable = True,
cfg = "exec",
default = "@com_google_protobuf//:protoc",
default = "//:protoc",
),
},
implementation = _py_proto_library_aspect_impl,

@ -413,25 +413,25 @@ def _get_upb_proto_library_aspect_provides():
upb_proto_library_aspect = aspect(
attrs = {
"_copts": attr.label(
default = "//:upb_proto_library_copts__for_generated_code_only_do_not_use",
default = "//upb:upb_proto_library_copts__for_generated_code_only_do_not_use",
),
"_gen_upb": attr.label(
executable = True,
cfg = "exec",
default = "//upbc:protoc-gen-upb_stage1",
default = "//upb/upbc:protoc-gen-upb_stage1",
),
"_protoc": attr.label(
executable = True,
cfg = "exec",
default = "@com_google_protobuf//:protoc",
default = "//:protoc",
),
"_cc_toolchain": attr.label(
default = "@bazel_tools//tools/cpp:current_cc_toolchain",
),
"_upb": attr.label_list(default = [
"//:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
"//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
]),
"_fasttable_enabled": attr.label(default = "//:fasttable_enabled"),
"_fasttable_enabled": attr.label(default = "//upb:fasttable_enabled"),
},
implementation = upb_proto_library_aspect_impl,
provides = _get_upb_proto_library_aspect_provides(),
@ -462,24 +462,24 @@ upb_c_proto_library = upb_proto_library
_upb_proto_reflection_library_aspect = aspect(
attrs = {
"_copts": attr.label(
default = "//:upb_proto_library_copts__for_generated_code_only_do_not_use",
default = "//upb:upb_proto_library_copts__for_generated_code_only_do_not_use",
),
"_gen_upbdefs": attr.label(
executable = True,
cfg = "exec",
default = "//upbc:protoc-gen-upbdefs",
default = "//upb/upbc:protoc-gen-upbdefs",
),
"_protoc": attr.label(
executable = True,
cfg = "exec",
default = "@com_google_protobuf//:protoc",
default = "//:protoc",
),
"_cc_toolchain": attr.label(
default = "@bazel_tools//tools/cpp:current_cc_toolchain",
),
"_upbdefs": attr.label_list(
default = [
"//:generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
"//upb:generated_reflection_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
],
),
},

@ -1,6 +1,6 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//bazel:python_downloads.bzl", "python_nuget_package", "python_source_archive")
load("//upb/bazel:python_downloads.bzl", "python_nuget_package", "python_source_archive")
def _github_archive(repo, commit, **kwargs):
repo_name = repo.split("/")[-1]

@ -12,7 +12,7 @@ load("@rules_python//python:defs.bzl", "py_binary")
# end:google_only
load(
"//bazel:upb_proto_library.bzl",
"//upb/bazel:upb_proto_library.bzl",
"upb_proto_library",
"upb_proto_reflection_library",
)
@ -25,7 +25,7 @@ load(
)
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# package(default_applicable_licenses = ["//upb:license"])
# end:google_only
licenses(["notice"])
@ -75,14 +75,14 @@ cc_test(
":benchmark_descriptor_sv_cc_proto",
":benchmark_descriptor_upb_proto",
":benchmark_descriptor_upb_proto_reflection",
"//:base",
"//:base_internal",
"//:descriptor_upb_proto",
"//:mem",
"//:reflection",
"//:protobuf",
"//upb:base",
"//upb:base_internal",
"//upb:descriptor_upb_proto",
"//upb:mem",
"//upb:reflection",
"@com_github_google_benchmark//:benchmark_main",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_protobuf//:protobuf",
],
)

@ -38,15 +38,15 @@
#include "google/protobuf/descriptor.pb.h"
#include "absl/container/flat_hash_set.h"
#include "google/protobuf/dynamic_message.h"
#include "benchmarks/descriptor.pb.h"
#include "benchmarks/descriptor.upb.h"
#include "benchmarks/descriptor.upbdefs.h"
#include "benchmarks/descriptor_sv.pb.h"
#include "upb/base/internal/log2.h"
#include "upb/mem/arena.h"
#include "upb/reflection/def.hpp"
upb_StringView descriptor = benchmarks_descriptor_proto_upbdefinit.descriptor;
#include "upb/benchmarks/descriptor.pb.h"
#include "upb/benchmarks/descriptor.upb.h"
#include "upb/benchmarks/descriptor.upbdefs.h"
#include "upb/benchmarks/descriptor_sv.pb.h"
#include "upb/upb/base/internal/log2.h"
#include "upb/upb/mem/arena.h"
#include "upb/upb/reflection/def.hpp"
upb_StringView descriptor = upb_benchmarks_descriptor_proto_upbdefinit.descriptor;
namespace protobuf = ::google::protobuf;
// A buffer big enough to parse descriptor.proto without going to heap.

@ -10,7 +10,7 @@ load(
"staleness_test",
)
load(
"//bazel:build_defs.bzl",
"//upb/bazel:build_defs.bzl",
"make_shell_script",
)
@ -35,21 +35,17 @@ py_binary(
genrule(
name = "gen_cmakelists",
srcs = [
"//:BUILD",
"//:WORKSPACE",
"//bazel:workspace_deps.bzl",
"//upb:BUILD",
],
outs = ["generated-in/CMakeLists.txt"],
cmd = "$(location :make_cmakelists) " +
"$(location //bazel:workspace_deps.bzl) " +
"$(location //:WORKSPACE) " +
"$(location //:BUILD) $@",
"$(location //upb:BUILD) $@",
tools = [":make_cmakelists"],
)
genrule(
name = "copy_protos",
srcs = ["//:descriptor_upb_proto"],
srcs = ["//upb:descriptor_upb_proto"],
outs = [
"generated-in/google/protobuf/descriptor.upb.c",
"generated-in/google/protobuf/descriptor.upb.h",
@ -85,18 +81,18 @@ sh_test(
data = [
":copy_protos",
":gen_cmakelists",
"//:source_files",
"//upb/base:source_files",
"//upb/collections:source_files",
"//upb/hash:source_files",
"//upb/lex:source_files",
"//upb/mem:source_files",
"//upb/message:source_files",
"//upb/mini_descriptor:source_files",
"//upb/mini_table:source_files",
"//upb/port:source_files",
"//upb/text:source_files",
"//upb/wire:source_files",
"//upb:source_files",
"//upb/upb/base:source_files",
"//upb/upb/collections:source_files",
"//upb/upb/hash:source_files",
"//upb/upb/lex:source_files",
"//upb/upb/mem:source_files",
"//upb/upb/message:source_files",
"//upb/upb/mini_descriptor:source_files",
"//upb/upb/mini_table:source_files",
"//upb/upb/port:source_files",
"//upb/upb/text:source_files",
"//upb/upb/wire:source_files",
"@utf8_range//:utf8_range_srcs",
],
target_compatible_with = select({

@ -27,7 +27,7 @@ def staleness_test(name, outs, generated_pattern, target_files = None, tags = []
"""
script_name = name + ".py"
script_src = Label("//cmake:staleness_test.py")
script_src = Label("//upb/cmake:staleness_test.py")
# Filter out non-existing rules so Blaze doesn't error out before we even
# run the test.
@ -52,7 +52,7 @@ def staleness_test(name, outs, generated_pattern, target_files = None, tags = []
data = existing_outs + [generated_pattern % file for file in outs],
python_version = "PY3",
deps = [
Label("//cmake:staleness_test_lib"),
Label("//upb/cmake:staleness_test_lib"),
],
tags = ["staleness_test"] + tags,
**kwargs

@ -30,7 +30,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""A tool to convert {WORKSPACE, BUILD} -> CMakeLists.txt.
"""A tool to convert BUILD -> CMakeLists.txt.
This tool is very upb-specific at the moment, and should not be seen as a
generic Bazel -> CMake converter.
@ -236,92 +236,14 @@ class BuildFileFunctions(object):
pass
class WorkspaceFileFunctions(object):
def __init__(self, converter):
self.converter = converter
def load(self, *args, **kwargs):
pass
def workspace(self, **kwargs):
self.converter.prelude += "project(%s)\n" % (kwargs["name"])
self.converter.prelude += "set(CMAKE_C_STANDARD 99)\n"
def maybe(self, rule, **kwargs):
if kwargs["name"] == "utf8_range":
self.converter.utf8_range_commit = kwargs["commit"]
pass
def http_archive(self, **kwargs):
pass
def git_repository(self, **kwargs):
pass
def new_git_repository(self, **kwargs):
pass
def bazel_version_repository(self, **kwargs):
pass
def protobuf_deps(self):
pass
def utf8_range_deps(self):
pass
def pip_parse(self, **kwargs):
pass
def rules_fuzzing_dependencies(self):
pass
def rules_fuzzing_init(self):
pass
def rules_pkg_dependencies(self):
pass
def system_python(self, **kwargs):
pass
def register_system_python(self, **kwargs):
pass
def register_toolchains(self, toolchain):
pass
def python_source_archive(self, **kwargs):
pass
def python_nuget_package(self, **kwargs):
pass
def install_deps(self):
pass
def fuzzing_py_install_deps(self):
pass
def googletest_deps(self):
pass
def local_repository(self, **kwargs):
pass
class Converter(object):
def __init__(self):
self.prelude = ""
self.toplevel = ""
self.if_lua = ""
self.utf8_range_commit = ""
def convert(self):
return self.template % {
"prelude": converter.prelude,
"toplevel": converter.toplevel,
"utf8_range_commit": converter.utf8_range_commit,
}
template = textwrap.dedent("""\
@ -329,7 +251,8 @@ class Converter(object):
cmake_minimum_required(VERSION 3.10...3.24)
%(prelude)s
project(upb)
set(CMAKE_C_STANDARD 99)
# Prevent CMake from setting -rdynamic on Linux (!!).
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
@ -366,7 +289,7 @@ class Converter(object):
endif()
if(NOT TARGET utf8_range)
if(EXISTS ../external/utf8_range)
if(EXISTS ../../external/utf8_range)
# utf8_range is already installed
include_directories(../external/utf8_range)
elseif(EXISTS ../../utf8_range)
@ -376,7 +299,7 @@ class Converter(object):
FetchContent_Declare(
utf8_range
GIT_REPOSITORY "https://github.com/protocolbuffers/utf8_range.git"
GIT_TAG "%(utf8_range_commit)s"
GIT_TAG "d863bc33e15cba6d873c878dcca9e6fe52b2f8cb"
)
FetchContent_GetProperties(utf8_range)
if(NOT utf8_range_POPULATED)
@ -412,12 +335,9 @@ def GetDict(obj):
globs = GetDict(converter)
workspace_dict = GetDict(WorkspaceFileFunctions(converter))
# We take all file paths as command-line arguments to ensure that we can find
# each file regardless of how exactly Bazel was invoked.
exec(open(sys.argv[1]).read(), workspace_dict) # workspace_deps.bzl
exec(open(sys.argv[2]).read(), workspace_dict) # WORKSPACE
exec(open(sys.argv[3]).read(), GetDict(BuildFileFunctions(converter))) # BUILD
# We take the BUILD path as a command-line argument to ensure that we can find
# it regardless of how exactly Bazel was invoked.
exec(open(sys.argv[1]).read(), GetDict(BuildFileFunctions(converter))) # BUILD
with open(sys.argv[4], "w") as f:
with open(sys.argv[2], "w") as f:
f.write(converter.convert())

@ -36,7 +36,7 @@ with the actual list of files before we actually run the script.
from __future__ import absolute_import
from cmake import staleness_test_lib
from upb.cmake import staleness_test_lib
import unittest
import sys

@ -173,8 +173,8 @@ class MyMessage(_message.Message):
To use reflection-based access:
1. Load and access descriptor data using the interfaces in upb/reflection/def.h.
2. Access message data using the interfaces in upb/reflection/message.h.
1. Load and access descriptor data using the interfaces in upb/upb/reflection/def.h.
2. Access message data using the interfaces in upb/upb/reflection/message.h.
### MiniTables
@ -234,8 +234,8 @@ APIs to do this do not exist yet.
To use MiniTable-based access:
1. Load and access MiniDescriptors data using the interfaces in upb/mini_descriptor/decode.h.
2. Access message data using the interfaces in upb/message/accessors.h.
1. Load and access MiniDescriptors data using the interfaces in upb/upb/mini_descriptor/decode.h.
2. Access message data using the interfaces in upb/upb/message/accessors.h.
## Memory Management

@ -6,12 +6,12 @@
# https://developers.google.com/open-source/licenses/bsd
load(
"//bazel:build_defs.bzl",
"//upb/bazel:build_defs.bzl",
"UPB_DEFAULT_COPTS",
"UPB_DEFAULT_CPPOPTS",
)
load(
"//lua:lua_proto_library.bzl",
"//upb/lua:lua_proto_library.bzl",
"lua_proto_library",
)
@ -30,10 +30,10 @@ cc_library(
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
deps = [
"//:json",
"//:message",
"//:reflection",
"//:text",
"//upb:json",
"//upb:message",
"//upb:reflection",
"//upb:text",
"@lua//:liblua",
],
)
@ -44,8 +44,8 @@ cc_binary(
copts = UPB_DEFAULT_CPPOPTS,
visibility = ["//visibility:public"],
deps = [
"//src/google/protobuf/compiler:code_generator",
"@com_google_absl//absl/strings",
"@com_google_protobuf//src/google/protobuf/compiler:code_generator",
],
)
@ -63,15 +63,15 @@ cc_test(
":test_messages_proto2_proto_lua",
":test_messages_proto3_proto_lua",
":test_proto_lua",
"//:third_party/lunit/console.lua",
"//:third_party/lunit/lunit.lua",
"//lua:upb.lua",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//conformance:conformance_proto",
"//:descriptor_proto",
"//conformance:conformance_proto",
"//upb:third_party/lunit/console.lua",
"//upb:third_party/lunit/lunit.lua",
"//upb/lua:upb.lua",
],
linkstatic = 1,
deps = [
"//lua:lupb",
"//upb/lua:lupb",
"@lua//:liblua",
],
)
@ -80,7 +80,7 @@ proto_library(
name = "test_proto",
testonly = 1,
srcs = ["test.proto"],
deps = ["@com_google_protobuf//:timestamp_proto"],
deps = ["//:timestamp_proto"],
)
lua_proto_library(
@ -91,22 +91,22 @@ lua_proto_library(
lua_proto_library(
name = "descriptor_proto_lua",
deps = ["@com_google_protobuf//:descriptor_proto"],
deps = ["//:descriptor_proto"],
)
lua_proto_library(
name = "empty_proto_lua",
deps = ["@com_google_protobuf//:empty_proto"],
deps = ["//:empty_proto"],
)
lua_proto_library(
name = "test_messages_proto3_proto_lua",
testonly = 1,
deps = ["@com_google_protobuf//src/google/protobuf:test_messages_proto3_proto"],
deps = ["//src/google/protobuf:test_messages_proto3_proto"],
)
lua_proto_library(
name = "test_messages_proto2_proto_lua",
testonly = 1,
deps = ["@com_google_protobuf//src/google/protobuf:test_messages_proto2_proto"],
deps = ["//src/google/protobuf:test_messages_proto2_proto"],
)

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "upb/reflection/def.h"
#include "upb/upb/reflection/def.h"
#include <float.h>
#include <math.h>
@ -36,8 +36,8 @@
#include <string.h>
#include "lauxlib.h"
#include "lua/upb.h"
#include "upb/reflection/message.h"
#include "upb/lua/upb.h"
#include "upb/upb/reflection/message.h"
#define LUPB_ENUMDEF "lupb.enumdef"
#define LUPB_ENUMVALDEF "lupb.enumvaldef"

@ -109,12 +109,12 @@ _lua_proto_library_aspect = aspect(
"_upbc": attr.label(
executable = True,
cfg = "exec",
default = "//lua:protoc-gen-lua",
default = "//upb/lua:protoc-gen-lua",
),
"_protoc": attr.label(
executable = True,
cfg = "exec",
default = "@com_google_protobuf//:protoc",
default = "//:protoc",
),
},
implementation = _lua_proto_library_aspect_impl,

@ -33,7 +33,7 @@
#include <lualib.h>
#include <signal.h>
#include "lua/upb.h"
#include "upb/lua/upb.h"
lua_State* L;
@ -53,13 +53,13 @@ const char* init =
"package.preload['lupb'] = ... "
"package.path = '"
"./?.lua;"
"./third_party/lunit/?.lua;"
"./upb/third_party/lunit/?.lua;"
"external/com_google_protobuf/?.lua;"
"external/com_google_protobuf/src/?.lua;"
"bazel-bin/?.lua;"
"bazel-bin/external/com_google_protobuf/src/?.lua;"
"bazel-bin/external/com_google_protobuf/?.lua;"
"lua/?.lua;"
"upb/lua/?.lua;"
// These additional paths handle the case where this test is invoked from
// the protobuf repo's Bazel workspace.
"external/upb/?.lua;"

@ -39,14 +39,14 @@
#include <string.h>
#include "lauxlib.h"
#include "lua/upb.h"
#include "upb/collections/map.h"
#include "upb/json/decode.h"
#include "upb/json/encode.h"
#include "upb/message/message.h"
#include "upb/port/def.inc"
#include "upb/reflection/message.h"
#include "upb/text/encode.h"
#include "upb/lua/upb.h"
#include "upb/upb/collections/map.h"
#include "upb/upb/json/decode.h"
#include "upb/upb/json/encode.h"
#include "upb/upb/message/message.h"
#include "upb/upb/port/def.inc"
#include "upb/upb/reflection/message.h"
#include "upb/upb/text/encode.h"
/*
* Message/Map/Array objects. These objects form a directed graph: a message

@ -34,7 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
local upb = require "lupb"
local lunit = require "lunit"
local upb_test = require "lua.test_pb"
local upb_test = require "upb.lua.test_pb"
local test_messages_proto3 = require "google.protobuf.test_messages_proto3_pb"
local test_messages_proto2 = require "google.protobuf.test_messages_proto2_pb"
local descriptor = require "google.protobuf.descriptor_pb"

@ -50,7 +50,7 @@
* domain of [u]int64 values.
*/
#include "lua/upb.h"
#include "upb/lua/upb.h"
#include <float.h>
#include <math.h>
@ -59,7 +59,7 @@
#include <string.h>
#include "lauxlib.h"
#include "upb/message/message.h"
#include "upb/upb/message/message.h"
/* Lua compatibility code *****************************************************/

@ -36,9 +36,9 @@
#define UPB_LUA_UPB_H_
#include "lauxlib.h"
#include "upb/message/message.h"
#include "upb/reflection/def.h"
#include "upb/reflection/message.h"
#include "upb/upb/message/message.h"
#include "upb/upb/reflection/def.h"
#include "upb/upb/reflection/message.h"
/* Lua changes its API in incompatible ways in every minor release.
* This is some shim code to paper over the differences. */

@ -6,16 +6,16 @@
# https://developers.google.com/open-source/licenses/bsd
load(
"//bazel:build_defs.bzl",
"//upb/bazel:build_defs.bzl",
"UPB_DEFAULT_CPPOPTS",
)
load(
"//protos/bazel:upb_cc_proto_library.bzl",
"//upb/protos/bazel:upb_cc_proto_library.bzl",
"upb_cc_proto_library_copts",
)
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# package(default_applicable_licenses = ["//upb:license"])
# end:google_only
licenses(["notice"])
@ -31,13 +31,13 @@ cc_library(
deps = [
":protos",
":protos_traits",
"//:base",
"//:collections",
"//:collections_internal",
"//:mem",
"//:message_copy",
"//:message_types",
"//:port",
"//upb:base",
"//upb:collections",
"//upb:collections_internal",
"//upb:mem",
"//upb:message_copy",
"//upb:message_types",
"//upb:port",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/strings",
],
@ -55,16 +55,16 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":protos_extension_lock",
"//:base",
"//:mem",
"//:message_accessors_internal",
"//:message_copy",
"//:message_internal",
"//:message_promote",
"//:message_types",
"//:mini_table",
"//:wire",
"//:wire_types",
"//upb:base",
"//upb:mem",
"//upb:message_accessors_internal",
"//upb:message_copy",
"//upb:message_internal",
"//upb:message_promote",
"//upb:message_types",
"//upb:mini_table",
"//upb:wire",
"//upb:wire_types",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
@ -89,9 +89,9 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":protos",
"//:mem",
"//:message",
"//:mini_table",
"//upb:mem",
"//upb:message",
"//upb:mini_table",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings:str_format",
@ -105,7 +105,7 @@ cc_library(
copts = UPB_DEFAULT_CPPOPTS,
visibility = ["//visibility:public"],
deps = [
"//:message",
"//upb:message",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/synchronization",
],
@ -123,8 +123,8 @@ cc_library(
":protos",
":protos_internal",
":repeated_field",
"//:mem",
"//:message",
"//upb:mem",
"//upb:message",
],
)
@ -134,9 +134,9 @@ cc_test(
copts = UPB_DEFAULT_CPPOPTS,
deps = [
":protos_internal",
"//:mem",
"//protos_generator/tests:test_model_upb_cc_proto",
"//protos_generator/tests:test_model_upb_proto",
"//upb:mem",
"//upb/protos_generator/tests:test_model_upb_cc_proto",
"//upb/protos_generator/tests:test_model_upb_proto",
"@com_google_googletest//:gtest_main",
],
)
@ -160,10 +160,10 @@ cc_test(
name = "protos_extension_lock_test",
srcs = ["protos_extension_lock_test.cc"],
deps = [
"//:mem",
"//protos",
"//protos:protos_extension_lock",
"//protos_generator/tests:test_model_upb_cc_proto",
"//upb:mem",
"//upb/protos",
"//upb/protos:protos_extension_lock",
"//upb/protos_generator/tests:test_model_upb_cc_proto",
"@com_google_absl//absl/hash",
"@com_google_absl//absl/log:absl_check",
"@com_google_googletest//:gtest_main",

@ -8,7 +8,7 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# package(default_applicable_licenses = ["//upb:license"])
# end:google_only
licenses(["notice"])
@ -18,7 +18,7 @@ bzl_library(
srcs = ["upb_cc_proto_library.bzl"],
visibility = ["//visibility:public"],
deps = [
"//bazel:upb_proto_library_bzl",
"//upb/bazel:upb_proto_library_bzl",
"@bazel_skylib//lib:paths",
"@bazel_tools//tools/cpp:toolchain_utils.bzl",
],

@ -10,7 +10,7 @@
"""
load("@bazel_skylib//lib:paths.bzl", "paths")
load("//bazel:upb_proto_library.bzl", "GeneratedSrcsInfo", "UpbWrappedCcInfo", "upb_proto_library_aspect")
load("//upb/bazel:upb_proto_library.bzl", "GeneratedSrcsInfo", "UpbWrappedCcInfo", "upb_proto_library_aspect")
# begin:google_only
# load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
@ -229,17 +229,17 @@ def _upb_cc_proto_library_aspect_impl(target, ctx):
_upb_cc_proto_library_aspect = aspect(
attrs = {
"_ccopts": attr.label(
default = "//protos:upb_cc_proto_library_copts__for_generated_code_only_do_not_use",
default = "//upb/protos:upb_cc_proto_library_copts__for_generated_code_only_do_not_use",
),
"_gen_upbprotos": attr.label(
executable = True,
cfg = "exec",
default = "//protos_generator:protoc-gen-upb-protos",
default = "//upb/protos_generator:protoc-gen-upb-protos",
),
"_protoc": attr.label(
executable = True,
cfg = "exec",
default = "@com_google_protobuf//:protoc",
default = "//:protoc",
),
"_cc_toolchain": attr.label(
default = "@bazel_tools//tools/cpp:current_cc_toolchain",
@ -247,12 +247,12 @@ _upb_cc_proto_library_aspect = aspect(
"_upbprotos": attr.label_list(
default = [
# TODO: Add dependencies for cc runtime (absl/string etc..)
"//:generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
"//protos:generated_protos_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
"//upb:generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
"//upb/protos:generated_protos_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/status:statusor",
"//protos",
"//protos:repeated_field",
"//upb/protos",
"//upb/protos:repeated_field",
],
),
},
@ -283,7 +283,7 @@ upb_cc_proto_library = rule(
providers = [ProtoInfo],
),
"_ccopts": attr.label(
default = "//protos:upb_cc_proto_library_copts__for_generated_code_only_do_not_use",
default = "//upb/protos:upb_cc_proto_library_copts__for_generated_code_only_do_not_use",
),
},
)

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos/protos.h"
#include "upb/protos/protos.h"
#include <atomic>
#include <cstddef>
@ -37,18 +37,18 @@
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "protos/protos_extension_lock.h"
#include "upb/mem/arena.h"
#include "upb/message/copy.h"
#include "upb/message/internal/extension.h"
#include "upb/message/promote.h"
#include "upb/message/types.h"
#include "upb/mini_table/extension.h"
#include "upb/mini_table/extension_registry.h"
#include "upb/mini_table/message.h"
#include "upb/wire/decode.h"
#include "upb/wire/encode.h"
#include "upb/wire/types.h"
#include "upb/protos/protos_extension_lock.h"
#include "upb/upb/mem/arena.h"
#include "upb/upb/message/copy.h"
#include "upb/upb/message/internal/extension.h"
#include "upb/upb/message/promote.h"
#include "upb/upb/message/types.h"
#include "upb/upb/mini_table/extension.h"
#include "upb/upb/mini_table/extension_registry.h"
#include "upb/upb/mini_table/message.h"
#include "upb/upb/wire/decode.h"
#include "upb/upb/wire/encode.h"
#include "upb/upb/wire/types.h"
namespace protos {

@ -36,13 +36,13 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "upb/base/status.hpp"
#include "upb/mem/arena.hpp"
#include "upb/message/copy.h"
#include "upb/message/internal/accessors.h"
#include "upb/message/internal/extension.h"
#include "upb/wire/decode.h"
#include "upb/wire/encode.h"
#include "upb/upb/base/status.hpp"
#include "upb/upb/mem/arena.hpp"
#include "upb/upb/message/copy.h"
#include "upb/upb/message/internal/accessors.h"
#include "upb/upb/message/internal/extension.h"
#include "upb/upb/wire/decode.h"
#include "upb/upb/wire/encode.h"
namespace protos {

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos/protos_extension_lock.h"
#include "upb/protos/protos_extension_lock.h"
#include <atomic>

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos/protos_extension_lock.h"
#include "upb/protos/protos_extension_lock.h"
#include <atomic>
#include <mutex>
@ -39,9 +39,9 @@
#include "gtest/gtest.h"
#include "absl/hash/hash.h"
#include "absl/log/absl_check.h"
#include "protos/protos.h"
#include "protos_generator/tests/test_model.upb.proto.h"
#include "upb/mem/arena.hpp"
#include "upb/protos/protos.h"
#include "upb/protos_generator/tests/test_model.upb.proto.h"
#include "upb/upb/mem/arena.hpp"
#ifndef ASSERT_OK
#define ASSERT_OK(x) ASSERT_TRUE(x.ok())

@ -31,8 +31,8 @@
#ifndef UPB_PROTOS_PROTOS_INTERNAL_H_
#define UPB_PROTOS_PROTOS_INTERNAL_H_
#include "upb/mem/arena.h"
#include "upb/message/message.h"
#include "upb/upb/mem/arena.h"
#include "upb/upb/message/message.h"
namespace protos::internal {

@ -28,13 +28,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos/protos_internal.h"
#include "upb/protos/protos_internal.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "protos_generator/tests/test_model.upb.h"
#include "protos_generator/tests/test_model.upb.proto.h"
#include "upb/mem/arena.h"
#include "upb/protos_generator/tests/test_model.upb.h"
#include "upb/protos_generator/tests/test_model.upb.proto.h"
#include "upb/upb/mem/arena.h"
namespace protos::testing {
namespace {

@ -37,17 +37,17 @@
#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "protos/protos.h"
#include "protos/protos_traits.h"
#include "protos/repeated_field_iterator.h"
#include "upb/base/string_view.h"
#include "upb/collections/array.h"
#include "upb/collections/internal/array.h"
#include "upb/mem/arena.h"
#include "upb/message/copy.h"
#include "upb/protos/protos.h"
#include "upb/protos/protos_traits.h"
#include "upb/protos/repeated_field_iterator.h"
#include "upb/upb/base/string_view.h"
#include "upb/upb/collections/array.h"
#include "upb/upb/collections/internal/array.h"
#include "upb/upb/mem/arena.h"
#include "upb/upb/message/copy.h"
// Must be last:
#include "upb/port/def.inc"
#include "upb/upb/port/def.inc"
namespace protos {
@ -321,6 +321,6 @@ class RepeatedField {
} // namespace protos
#include "upb/port/undef.inc"
#include "upb/upb/port/undef.inc"
#endif // UPB_PROTOS_REPEATED_FIELD_H_

@ -36,15 +36,15 @@
#include <type_traits>
#include "absl/strings/string_view.h"
#include "protos/protos.h"
#include "upb/base/string_view.h"
#include "upb/collections/array.h"
#include "upb/mem/arena.h"
#include "upb/message/copy.h"
#include "upb/protos/protos.h"
#include "upb/upb/base/string_view.h"
#include "upb/upb/collections/array.h"
#include "upb/upb/mem/arena.h"
#include "upb/upb/message/copy.h"
// Must be last:
#include "upb/message/types.h"
#include "upb/port/def.inc"
#include "upb/upb/message/types.h"
#include "upb/upb/port/def.inc"
namespace protos {
namespace internal {

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos/repeated_field_iterator.h"
#include "upb/protos/repeated_field_iterator.h"
#include <algorithm>
#include <array>

@ -6,12 +6,12 @@
# https://developers.google.com/open-source/licenses/bsd
load(
"//bazel:build_defs.bzl",
"//upb/bazel:build_defs.bzl",
"UPB_DEFAULT_CPPOPTS",
)
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# package(default_applicable_licenses = ["//upb:license"])
# end:google_only
licenses(["notice"])
@ -28,9 +28,9 @@ cc_binary(
":generator",
":names",
":output",
"//upbc:file_layout",
"@com_google_protobuf//:protobuf",
"@com_google_protobuf//src/google/protobuf/compiler:code_generator",
"//:protobuf",
"//src/google/protobuf/compiler:code_generator",
"//upb/upbc:file_layout",
],
)
@ -55,13 +55,13 @@ cc_library(
":gen_utils",
":names",
":output",
"//upbc:common",
"//upbc:file_layout",
"//upbc:keywords",
"//upbc:names",
"//:protobuf",
"//upb/upbc:common",
"//upb/upbc:file_layout",
"//upb/upbc:keywords",
"//upb/upbc:names",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf",
],
)
@ -71,9 +71,9 @@ cc_library(
hdrs = ["output.h"],
visibility = ["//visibility:private"],
deps = [
"//:protobuf",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf",
],
)
@ -83,9 +83,9 @@ cc_library(
hdrs = ["gen_utils.h"],
visibility = ["//visibility:public"],
deps = [
"//:protobuf",
"//src/google/protobuf/compiler:code_generator",
"@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf",
"@com_google_protobuf//src/google/protobuf/compiler:code_generator",
],
)
@ -96,6 +96,6 @@ cc_library(
visibility = ["//visibility:private"],
deps = [
":output",
"//upbc:keywords",
"//upb/upbc:keywords",
],
)

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos_generator/gen_accessors.h"
#include "upb/protos_generator/gen_accessors.h"
#include <string>
@ -37,13 +37,13 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/descriptor.h"
#include "protos_generator/gen_repeated_fields.h"
#include "protos_generator/gen_utils.h"
#include "protos_generator/names.h"
#include "protos_generator/output.h"
#include "upbc/common.h"
#include "upbc/keywords.h"
#include "upbc/names.h"
#include "upb/protos_generator/gen_repeated_fields.h"
#include "upb/protos_generator/gen_utils.h"
#include "upb/protos_generator/names.h"
#include "upb/protos_generator/output.h"
#include "upb/upbc/common.h"
#include "upb/upbc/keywords.h"
#include "upb/upbc/names.h"
namespace protos_generator {

@ -32,8 +32,8 @@
#define UPB_PROTOS_GENERATOR_ACCESSORS_H_
#include "google/protobuf/descriptor.h"
#include "protos_generator/gen_utils.h"
#include "protos_generator/output.h"
#include "upb/protos_generator/gen_utils.h"
#include "upb/protos_generator/output.h"
namespace protos_generator {

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos_generator/gen_enums.h"
#include "upb/protos_generator/gen_enums.h"
#include <algorithm>
#include <limits>
@ -37,8 +37,8 @@
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "protos_generator/gen_utils.h"
#include "protos_generator/names.h"
#include "upb/protos_generator/gen_utils.h"
#include "upb/protos_generator/names.h"
namespace protos_generator {

@ -32,7 +32,7 @@
#define UPB_PROTOS_GENERATOR_ENUMS_H_
#include "google/protobuf/descriptor.h"
#include "protos_generator/output.h"
#include "upb/protos_generator/output.h"
namespace protos_generator {

@ -28,11 +28,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos_generator/gen_extensions.h"
#include "upb/protos_generator/gen_extensions.h"
#include "absl/strings/str_cat.h"
#include "protos_generator/gen_utils.h"
#include "protos_generator/names.h"
#include "upb/protos_generator/gen_utils.h"
#include "upb/protos_generator/names.h"
namespace protos_generator {

@ -32,7 +32,7 @@
#define UPB_PROTOS_GENERATOR_GEN_EXTENSIONS_H_
#include "google/protobuf/descriptor.h"
#include "protos_generator/output.h"
#include "upb/protos_generator/output.h"
namespace protos_generator {

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos_generator/gen_messages.h"
#include "upb/protos_generator/gen_messages.h"
#include <string>
#include <vector>
@ -36,14 +36,14 @@
#include "google/protobuf/descriptor.pb.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/descriptor.h"
#include "protos_generator/gen_accessors.h"
#include "protos_generator/gen_enums.h"
#include "protos_generator/gen_extensions.h"
#include "protos_generator/gen_utils.h"
#include "protos_generator/names.h"
#include "protos_generator/output.h"
#include "upbc/common.h"
#include "upbc/file_layout.h"
#include "upb/protos_generator/gen_accessors.h"
#include "upb/protos_generator/gen_enums.h"
#include "upb/protos_generator/gen_extensions.h"
#include "upb/protos_generator/gen_utils.h"
#include "upb/protos_generator/names.h"
#include "upb/protos_generator/output.h"
#include "upb/upbc/common.h"
#include "upb/upbc/file_layout.h"
namespace protos_generator {

@ -32,7 +32,7 @@
#define UPB_PROTOS_GENERATOR_GEN_MESSAGES_H_
#include "google/protobuf/descriptor.h"
#include "protos_generator/output.h"
#include "upb/protos_generator/output.h"
namespace protos_generator {
namespace protobuf = ::google::protobuf;

@ -27,7 +27,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos_generator/gen_repeated_fields.h"
#include "upb/protos_generator/gen_repeated_fields.h"
#include <string>
#include <vector>
@ -35,15 +35,15 @@
#include "google/protobuf/descriptor.pb.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/descriptor.h"
#include "protos_generator/gen_accessors.h"
#include "protos_generator/gen_enums.h"
#include "protos_generator/gen_extensions.h"
#include "protos_generator/gen_utils.h"
#include "protos_generator/names.h"
#include "protos_generator/output.h"
#include "upbc/common.h"
#include "upbc/file_layout.h"
#include "upbc/names.h"
#include "upb/protos_generator/gen_accessors.h"
#include "upb/protos_generator/gen_enums.h"
#include "upb/protos_generator/gen_extensions.h"
#include "upb/protos_generator/gen_utils.h"
#include "upb/protos_generator/names.h"
#include "upb/protos_generator/output.h"
#include "upb/upbc/common.h"
#include "upb/upbc/file_layout.h"
#include "upb/upbc/names.h"
namespace protos_generator {
namespace protobuf = ::google::protobuf;

@ -33,7 +33,7 @@
#include "absl/strings/string_view.h"
#include "google/protobuf/descriptor.h"
#include "protos_generator/output.h"
#include "upb/protos_generator/output.h"
namespace protos_generator {
namespace protobuf = ::google::protobuf;

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos_generator/gen_utils.h"
#include "upb/protos_generator/gen_utils.h"
#include <algorithm>
#include <string>

@ -28,11 +28,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos_generator/names.h"
#include "upb/protos_generator/names.h"
#include <string>
#include "upbc/keywords.h"
#include "upb/upbc/keywords.h"
namespace protos_generator {

@ -34,7 +34,7 @@
#include <string>
#include "google/protobuf/descriptor.pb.h"
#include "protos_generator/output.h"
#include "upb/protos_generator/output.h"
namespace protos_generator {

@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "protos_generator/output.h"
#include "upb/protos_generator/output.h"
#include <string>

@ -34,13 +34,13 @@
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/compiler/plugin.h"
#include "google/protobuf/descriptor.h"
#include "protos_generator/gen_enums.h"
#include "protos_generator/gen_extensions.h"
#include "protos_generator/gen_messages.h"
#include "protos_generator/gen_utils.h"
#include "protos_generator/names.h"
#include "protos_generator/output.h"
#include "upbc/file_layout.h"
#include "upb/protos_generator/gen_enums.h"
#include "upb/protos_generator/gen_extensions.h"
#include "upb/protos_generator/gen_messages.h"
#include "upb/protos_generator/gen_utils.h"
#include "upb/protos_generator/names.h"
#include "upb/protos_generator/output.h"
#include "upb/upbc/file_layout.h"
namespace protos_generator {
namespace {
@ -138,9 +138,9 @@ void WriteHeader(const protobuf::FileDescriptor* file, Output& output) {
#ifndef $0_UPB_PROTO_H_
#define $0_UPB_PROTO_H_
#include "protos/protos.h"
#include "protos/protos_internal.h"
#include "protos/repeated_field.h"
#include "upb/protos/protos.h"
#include "upb/protos/protos_internal.h"
#include "upb/protos/repeated_field.h"
#include "absl/strings/string_view.h"
#include "absl/status/statusor.h"
@ -158,7 +158,7 @@ void WriteHeader(const protobuf::FileDescriptor* file, Output& output) {
}
}
output("#include \"upb/port/def.inc\"\n");
output("#include \"upb/upb/port/def.inc\"\n");
const std::vector<const protobuf::Descriptor*> this_file_messages =
SortedMessages(file);
@ -190,7 +190,7 @@ void WriteHeader(const protobuf::FileDescriptor* file, Output& output) {
WriteEndNamespace(file, output);
output("\n#include \"upb/port/undef.inc\"\n\n");
output("\n#include \"upb/upb/port/undef.inc\"\n\n");
// End of "C" section.
output("#endif /* $0_UPB_PROTO_H_ */\n", ToPreproc(file->name()));
@ -205,7 +205,7 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output,
R"cc(
#include <stddef.h>
#include "absl/strings/string_view.h"
#include "protos/protos.h"
#include "upb/protos/protos.h"
#include "$0"
)cc",
CppHeaderFilename(file));
@ -213,7 +213,7 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output,
for (int i = 0; i < file->dependency_count(); i++) {
output("#include \"$0\"\n", CppHeaderFilename(file->dependency(i)));
}
output("#include \"upb/port/def.inc\"\n");
output("#include \"upb/upb/port/def.inc\"\n");
WriteStartNamespace(file, output);
WriteMessageImplementations(file, output);
@ -222,7 +222,7 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output,
WriteExtensionIdentifiers(this_file_exts, output);
WriteEndNamespace(file, output);
output("#include \"upb/port/undef.inc\"\n\n");
output("#include \"upb/upb/port/undef.inc\"\n\n");
}
void WriteMessageImplementations(const protobuf::FileDescriptor* file,

@ -6,15 +6,15 @@
# https://developers.google.com/open-source/licenses/bsd
load(
"//bazel:build_defs.bzl",
"//upb/bazel:build_defs.bzl",
"UPB_DEFAULT_CPPOPTS",
)
load(
"//bazel:upb_proto_library.bzl",
"//upb/bazel:upb_proto_library.bzl",
"upb_proto_library",
)
load(
"//protos/bazel:upb_cc_proto_library.bzl",
"//upb/protos/bazel:upb_cc_proto_library.bzl",
"upb_cc_proto_library",
)
load(
@ -23,7 +23,7 @@ load(
)
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# package(default_applicable_licenses = ["//upb:license"])
# end:google_only
licenses(["notice"])
@ -63,14 +63,14 @@ proto_library(
upb_proto_library(
name = "test_model_upb_proto",
visibility = [
"//protos:__pkg__",
"//upb/protos:__pkg__",
],
deps = [":test_model_proto"],
)
upb_cc_proto_library(
name = "test_model_upb_cc_proto",
visibility = ["//protos:__pkg__"],
visibility = ["//upb/protos:__pkg__"],
deps = [":test_model_proto"],
)
@ -133,8 +133,8 @@ cc_test(
"@com_google_googletest//:gtest_main",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"//protos",
"//:mem",
"//protos:repeated_field",
"//upb/protos",
"//upb:mem",
"//upb/protos:repeated_field",
],
)

@ -32,7 +32,7 @@ syntax = "proto3";
package protos_generator.test;
import public "protos_generator/tests/test_enum.proto";
import public "upb/protos_generator/tests/test_enum.proto";
message ChildModel1 {
optional bool child_b1 = 44;

@ -32,7 +32,7 @@ syntax = "proto2";
package protos_generator.tests;
import "protos_generator/tests/no_package.proto";
import "upb/protos_generator/tests/no_package.proto";
// option java_multiple_files = true;

@ -32,7 +32,7 @@ syntax = "proto2";
package protos_generator.test.someotherpackage;
import "protos_generator/tests/test_model.proto";
import "upb/protos_generator/tests/test_model.proto";
// Define extension that is extending proto outside this package with a type
// defined in different file.

@ -38,13 +38,13 @@
#include "gtest/gtest.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "protos/protos.h"
#include "protos/repeated_field.h"
#include "protos/repeated_field_iterator.h"
#include "protos_generator/tests/child_model.upb.proto.h"
#include "protos_generator/tests/no_package.upb.proto.h"
#include "protos_generator/tests/test_model.upb.proto.h"
#include "upb/mem/arena.h"
#include "upb/protos/protos.h"
#include "upb/protos/repeated_field.h"
#include "upb/protos/repeated_field_iterator.h"
#include "upb/protos_generator/tests/child_model.upb.proto.h"
#include "upb/protos_generator/tests/no_package.upb.proto.h"
#include "upb/protos_generator/tests/test_model.upb.proto.h"
#include "upb/upb/mem/arena.h"
namespace {

@ -32,7 +32,7 @@ syntax = "proto2";
package protos_generator.test;
import "protos_generator/tests/child_model.proto";
import "upb/protos_generator/tests/child_model.proto";
message TestModelContainer {
repeated TestModel models = 1;

@ -5,10 +5,10 @@
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
load("//python:py_extension.bzl", "py_extension")
load("//upb/python:py_extension.bzl", "py_extension")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")
load("//bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
# begin:github_only
load("@rules_pkg//:mappings.bzl", "pkg_files")
@ -18,9 +18,9 @@ licenses(["notice"])
package(
# begin:google_only
# default_applicable_licenses = ["//:license"],
# default_applicable_licenses = ["//upb:license"],
# end:google_only
default_visibility = ["//python/dist:__pkg__"],
default_visibility = ["//upb/python/dist:__pkg__"],
)
LIMITED_API_FLAG_SELECT = {
@ -214,18 +214,18 @@ py_extension(
],
target_compatible_with = select(_message_target_compatible_with),
deps = [
"//:collections",
"//:descriptor_upb_proto_reflection",
"//:eps_copy_input_stream",
"//:hash",
"//:message_copy",
"//:port",
"//:reflection",
"//:text",
"//:wire_reader",
"//:wire_types",
"//upb/util:compare",
"//upb/util:def_to_proto",
"//upb/util:required_fields",
"//upb:collections",
"//upb:descriptor_upb_proto_reflection",
"//upb:eps_copy_input_stream",
"//upb:hash",
"//upb:message_copy",
"//upb:port",
"//upb:reflection",
"//upb:text",
"//upb:wire_reader",
"//upb:wire_types",
"//upb/upb/util:compare",
"//upb/upb/util:def_to_proto",
"//upb/upb/util:required_fields",
],
)

@ -28,16 +28,16 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/convert.h"
#include "upb/python/convert.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/collections/map.h"
#include "upb/reflection/message.h"
#include "upb/util/compare.h"
#include "upb/python/message.h"
#include "upb/python/protobuf.h"
#include "upb/upb/collections/map.h"
#include "upb/upb/reflection/message.h"
#include "upb/upb/util/compare.h"
// Must be last.
#include "upb/port/def.inc"
#include "upb/upb/port/def.inc"
PyObject* PyUpb_UpbToPy(upb_MessageValue val, const upb_FieldDef* f,
PyObject* arena) {
@ -443,4 +443,4 @@ bool upb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
kUpb_UnknownCompareResult_Equal;
}
#include "upb/port/undef.inc"
#include "upb/upb/port/undef.inc"

@ -32,8 +32,8 @@
#define PYUPB_CONVERT_H__
#include "protobuf.h"
#include "upb/reflection/def.h"
#include "upb/reflection/message.h"
#include "upb/upb/reflection/def.h"
#include "upb/upb/reflection/message.h"
// Converts `val` to a Python object according to the type information in `f`.
// Any newly-created Python objects that reference non-primitive data from `val`

@ -28,15 +28,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/descriptor.h"
#include "python/convert.h"
#include "python/descriptor_containers.h"
#include "python/descriptor_pool.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/reflection/def.h"
#include "upb/util/def_to_proto.h"
#include "upb/python/descriptor.h"
#include "upb/python/convert.h"
#include "upb/python/descriptor_containers.h"
#include "upb/python/descriptor_pool.h"
#include "upb/python/message.h"
#include "upb/python/protobuf.h"
#include "upb/upb/reflection/def.h"
#include "upb/upb/util/def_to_proto.h"
// -----------------------------------------------------------------------------
// DescriptorBase

@ -33,8 +33,8 @@
#include <stdbool.h>
#include "python/python_api.h"
#include "upb/reflection/def.h"
#include "upb/python/python_api.h"
#include "upb/upb/reflection/def.h"
typedef enum {
kPyUpb_Descriptor = 0,

@ -28,11 +28,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/descriptor_containers.h"
#include "upb/python/descriptor_containers.h"
#include "python/descriptor.h"
#include "python/protobuf.h"
#include "upb/reflection/def.h"
#include "upb/python/descriptor.h"
#include "upb/python/protobuf.h"
#include "upb/upb/reflection/def.h"
// Implements __repr__ as str(dict(self)).
static PyObject* PyUpb_DescriptorMap_Repr(PyObject* _self) {

@ -46,7 +46,7 @@
#include <stdbool.h>
#include "protobuf.h"
#include "upb/reflection/def.h"
#include "upb/upb/reflection/def.h"
// -----------------------------------------------------------------------------
// PyUpb_GenericSequence

@ -28,15 +28,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/descriptor_pool.h"
#include "upb/python/descriptor_pool.h"
#include "google/protobuf/descriptor.upbdefs.h"
#include "python/convert.h"
#include "python/descriptor.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/reflection/def.h"
#include "upb/util/def_to_proto.h"
#include "upb/python/convert.h"
#include "upb/python/descriptor.h"
#include "upb/python/message.h"
#include "upb/python/protobuf.h"
#include "upb/upb/reflection/def.h"
#include "upb/upb/util/def_to_proto.h"
// -----------------------------------------------------------------------------
// DescriptorPool

@ -5,10 +5,10 @@
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
load("//bazel:py_proto_library.bzl", "py_proto_library")
load("//upb/bazel:py_proto_library.bzl", "py_proto_library")
load(":dist.bzl", "py_dist", "py_dist_module")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@com_google_protobuf//:protobuf_version.bzl", "PROTOBUF_PYTHON_VERSION")
load("//:protobuf_version.bzl", "PROTOBUF_PYTHON_VERSION")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_python//python:packaging.bzl", "py_wheel")
@ -18,36 +18,36 @@ licenses(["notice"])
py_dist_module(
name = "message_mod",
extension = "//python:_message_binary",
extension = "//upb/python:_message_binary",
module_name = "google._upb._message",
)
py_proto_library(
name = "well_known_proto_py_pb2",
deps = [
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:api_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:source_context_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:type_proto",
"@com_google_protobuf//:wrappers_proto",
"//:any_proto",
"//:api_proto",
"//:descriptor_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
"//:source_context_proto",
"//:struct_proto",
"//:timestamp_proto",
"//:type_proto",
"//:wrappers_proto",
],
)
py_proto_library(
name = "plugin_py_pb2",
deps = ["@com_google_protobuf//:compiler_plugin_proto"],
deps = ["//:compiler_plugin_proto"],
)
config_setting(
name = "linux_aarch64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
"//toolchain:release": "True",
},
values = {"cpu": "linux-aarch_64"},
)
@ -59,14 +59,14 @@ config_setting(
"@platforms//cpu:aarch64",
],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
"//toolchain:release": "False",
},
)
config_setting(
name = "linux_x86_64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
"//toolchain:release": "True",
},
values = {"cpu": "linux-x86_64"},
)
@ -78,14 +78,14 @@ config_setting(
"@platforms//cpu:x86_64",
],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
"//toolchain:release": "False",
},
)
config_setting(
name = "osx_x86_64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
"//toolchain:release": "True",
},
values = {"cpu": "osx-x86_64"},
)
@ -97,7 +97,7 @@ config_setting(
"@platforms//cpu:x86_64",
],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
"//toolchain:release": "False",
},
)
@ -112,7 +112,7 @@ selects.config_setting_group(
config_setting(
name = "osx_aarch64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
"//toolchain:release": "True",
},
values = {"cpu": "osx-aarch_64"},
)
@ -124,7 +124,7 @@ config_setting(
"@platforms//cpu:aarch64",
],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
"//toolchain:release": "False",
},
)
@ -144,7 +144,7 @@ config_setting(
config_setting(
name = "windows_x86_32_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
"//toolchain:release": "True",
},
values = {"cpu": "win32"},
)
@ -156,7 +156,7 @@ config_setting(
"@platforms//cpu:x86_32",
],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
"//toolchain:release": "False",
},
)
@ -171,7 +171,7 @@ selects.config_setting_group(
config_setting(
name = "windows_x86_64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
"//toolchain:release": "True",
},
values = {"cpu": "win64"},
)
@ -183,7 +183,7 @@ config_setting(
"@platforms//cpu:x86_64",
],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
"//toolchain:release": "False",
},
)
@ -199,8 +199,8 @@ pkg_files(
name = "generated_wkt",
srcs = [
":well_known_proto_py_pb2",
"//:descriptor_upb_proto",
"//:descriptor_upb_proto_reflection",
"//upb:descriptor_upb_proto",
"//upb:descriptor_upb_proto_reflection",
],
prefix = "google/protobuf",
)
@ -233,21 +233,21 @@ pkg_files(
pkg_files(
name = "filegroup_source_files",
srcs = [
"//:LICENSE",
"//:source_files",
"//python:message_srcs",
"//upb/base:source_files",
"//upb/collections:source_files",
"//upb/hash:source_files",
"//upb/lex:source_files",
"//upb/mem:source_files",
"//upb/message:source_files",
"//upb/mini_descriptor:source_files",
"//upb/mini_table:source_files",
"//upb/port:source_files",
"//upb/text:source_files",
"//upb/util:source_files",
"//upb/wire:source_files",
"//upb:LICENSE",
"//upb:source_files",
"//upb/python:message_srcs",
"//upb/upb/base:source_files",
"//upb/upb/collections:source_files",
"//upb/upb/hash:source_files",
"//upb/upb/lex:source_files",
"//upb/upb/mem:source_files",
"//upb/upb/message:source_files",
"//upb/upb/mini_descriptor:source_files",
"//upb/upb/mini_table:source_files",
"//upb/upb/port:source_files",
"//upb/upb/text:source_files",
"//upb/upb/util:source_files",
"//upb/upb/wire:source_files",
],
strip_prefix = strip_prefix.from_root(""),
)
@ -262,7 +262,7 @@ pkg_tar(
":generated_wkt",
":generated_wkt_compiler",
":utf8_range_source_files",
"@com_google_protobuf//python:python_source_files",
"//python:python_source_files",
],
extension = "tar.gz",
package_dir = "protobuf",
@ -295,9 +295,9 @@ genrule(
py_wheel(
name = "binary_wheel",
abi = select({
"//python:full_api_3.7": "cp37m",
"//python:full_api_3.8": "cp38",
"//python:full_api_3.9": "cp39",
"//upb/python:full_api_3.7": "cp37m",
"//upb/python:full_api_3.8": "cp38",
"//upb/python:full_api_3.9": "cp39",
"//conditions:default": "abi3",
}),
author = "protobuf@googlegroups.com",
@ -312,7 +312,7 @@ py_wheel(
],
distribution = "protobuf",
extra_distinfo_files = {
"//:LICENSE": "LICENSE",
"//upb:LICENSE": "LICENSE",
},
homepage = "https://developers.google.com/protocol-buffers/",
license = "3-Clause BSD License",
@ -329,10 +329,10 @@ py_wheel(
}),
python_requires = ">=3.7",
python_tag = selects.with_or({
("//python:limited_api_3.7", "//python:full_api_3.7"): "cp37",
"//python:full_api_3.8": "cp38",
"//python:full_api_3.9": "cp39",
"//python:limited_api_3.10": "cp310",
("//upb/python:limited_api_3.7", "//upb/python:full_api_3.7"): "cp37",
"//upb/python:full_api_3.8": "cp38",
"//upb/python:full_api_3.9": "cp39",
"//upb/python:limited_api_3.10": "cp310",
"//conditions:default": "cp" + SYSTEM_PYTHON_VERSION,
}),
strip_path_prefixes = [
@ -349,7 +349,7 @@ py_wheel(
":message_mod",
":plugin_py_pb2",
":well_known_proto_py_pb2",
"@com_google_protobuf//:python_srcs",
"//:python_srcs",
],
)
@ -368,7 +368,7 @@ py_wheel(
],
distribution = "protobuf",
extra_distinfo_files = {
"//:LICENSE": "LICENSE",
"//upb:LICENSE": "LICENSE",
},
homepage = "https://developers.google.com/protocol-buffers/",
license = "3-Clause BSD License",
@ -387,7 +387,7 @@ py_wheel(
deps = [
":plugin_py_pb2",
":well_known_proto_py_pb2",
"@com_google_protobuf//:python_srcs",
"//:python_srcs",
],
)
@ -397,7 +397,7 @@ py_wheel(
abi = "none",
distribution = "protobuftests",
extra_distinfo_files = {
"//:LICENSE": "LICENSE",
"//upb:LICENSE": "LICENSE",
},
platform = "any",
python_tag = "py3",
@ -411,11 +411,11 @@ py_wheel(
}),
version = PROTOBUF_PYTHON_VERSION,
deps = [
"//python/pb_unit_tests:test_files",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_test_srcs",
"@com_google_protobuf//src/google/protobuf:testdata",
"//:python_common_test_protos",
"//:python_specific_test_protos",
"//:python_test_srcs",
"//src/google/protobuf:testdata",
"//upb/python/pb_unit_tests:test_files",
],
)

@ -121,8 +121,8 @@ py_dist_module = rule(
mandatory = True,
cfg = _py_multiarch_transition,
),
"_limited_api": attr.label(default = "//python:limited_api"),
"_python_version": attr.label(default = "//python:python_version"),
"_limited_api": attr.label(default = "//upb/python:limited_api"),
"_python_version": attr.label(default = "//upb/python:python_version"),
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
@ -142,16 +142,16 @@ def _py_dist_transition_impl(settings, attr):
for cpu, version in attr.limited_api_wheels.items():
transitions.append({
"//command_line_option:cpu": cpu,
"//python:python_version": version,
"//python:limited_api": True,
"//upb/python:python_version": version,
"//upb/python:limited_api": True,
})
for version in attr.full_api_versions:
for cpu in attr.full_api_cpus:
transitions.append({
"//command_line_option:cpu": cpu,
"//python:python_version": version,
"//python:limited_api": False,
"//upb/python:python_version": version,
"//upb/python:limited_api": False,
})
return transitions
@ -161,8 +161,8 @@ _py_dist_transition = transition(
inputs = [],
outputs = [
"//command_line_option:cpu",
"//python:python_version",
"//python:limited_api",
"//upb/python:python_version",
"//upb/python:limited_api",
],
)

@ -28,11 +28,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/extension_dict.h"
#include "upb/python/extension_dict.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/reflection/def.h"
#include "upb/python/message.h"
#include "upb/python/protobuf.h"
#include "upb/upb/reflection/def.h"
// -----------------------------------------------------------------------------
// ExtensionDict

@ -33,7 +33,7 @@
#include <stdbool.h>
#include "python/python_api.h"
#include "upb/python/python_api.h"
PyObject* PyUpb_ExtensionDict_New(PyObject* msg);

@ -28,13 +28,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/map.h"
#include "upb/python/map.h"
#include "python/convert.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/collections/map.h"
#include "upb/reflection/def.h"
#include "upb/python/convert.h"
#include "upb/python/message.h"
#include "upb/python/protobuf.h"
#include "upb/upb/collections/map.h"
#include "upb/upb/reflection/def.h"
// -----------------------------------------------------------------------------
// MapContainer

@ -33,8 +33,8 @@
#include <stdbool.h>
#include "python/python_api.h"
#include "upb/reflection/def.h"
#include "upb/python/python_api.h"
#include "upb/upb/reflection/def.h"
// Creates a new repeated field stub for field `f` of message object `parent`.
// Precondition: `parent` must be a stub.

@ -28,18 +28,18 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/message.h"
#include "python/convert.h"
#include "python/descriptor.h"
#include "python/extension_dict.h"
#include "python/map.h"
#include "python/repeated.h"
#include "upb/message/copy.h"
#include "upb/reflection/def.h"
#include "upb/reflection/message.h"
#include "upb/text/encode.h"
#include "upb/util/required_fields.h"
#include "upb/python/message.h"
#include "upb/python/convert.h"
#include "upb/python/descriptor.h"
#include "upb/python/extension_dict.h"
#include "upb/python/map.h"
#include "upb/python/repeated.h"
#include "upb/upb/message/copy.h"
#include "upb/upb/reflection/def.h"
#include "upb/upb/reflection/message.h"
#include "upb/upb/text/encode.h"
#include "upb/upb/util/required_fields.h"
static const upb_MessageDef* PyUpb_MessageMeta_GetMsgdef(PyObject* cls);
static PyObject* PyUpb_MessageMeta_GetAttr(PyObject* self, PyObject* name);

@ -33,8 +33,8 @@
#include <stdbool.h>
#include "python/protobuf.h"
#include "upb/reflection/message.h"
#include "upb/python/protobuf.h"
#include "upb/upb/reflection/message.h"
// Removes the wrapper object for this field from the unset subobject cache.
void PyUpb_Message_CacheDelete(PyObject* _self, const upb_FieldDef* f);

@ -11,7 +11,7 @@ load("@pip_deps//:requirements.bzl", "requirement")
# end:github_only
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# package(default_applicable_licenses = ["//upb:license"])
# end:google_only
licenses(["notice"])
@ -41,8 +41,8 @@ py_test(
main = "numpy_test_wrapper.py",
deps = [
requirement("numpy"),
"@com_google_protobuf//python/google/protobuf/internal/numpy:numpy_test",
"//python:_message",
"//python/google/protobuf/internal/numpy:numpy_test",
"//upb/python:_message",
],
target_compatible_with = select({
"@system_python//:supported": [],
@ -79,6 +79,6 @@ filegroup(
name = "test_files",
srcs = glob(["*.py"]),
visibility = [
"//python/dist:__pkg__", # Scheuklappen: keep
"//upb/python/dist:__pkg__", # Scheuklappen: keep
],
)

@ -7,13 +7,13 @@ def pyproto_test_wrapper(name, deps = []):
srcs = [src],
legacy_create_init = False,
main = src,
data = ["@com_google_protobuf//src/google/protobuf:testdata"],
data = ["//src/google/protobuf:testdata"],
deps = [
"//python:_message",
"@com_google_protobuf//:python_common_test_protos",
"@com_google_protobuf//:python_specific_test_protos",
"@com_google_protobuf//:python_test_srcs",
"@com_google_protobuf//:python_srcs",
"//upb/python:_message",
"//:python_common_test_protos",
"//:python_specific_test_protos",
"//:python_test_srcs",
"//:python_srcs",
] + deps,
target_compatible_with = select({
"@system_python//:supported": [],

@ -28,16 +28,16 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/protobuf.h"
#include "python/descriptor.h"
#include "python/descriptor_containers.h"
#include "python/descriptor_pool.h"
#include "python/extension_dict.h"
#include "python/map.h"
#include "python/message.h"
#include "python/repeated.h"
#include "python/unknown_fields.h"
#include "upb/python/protobuf.h"
#include "upb/python/descriptor.h"
#include "upb/python/descriptor_containers.h"
#include "upb/python/descriptor_pool.h"
#include "upb/python/extension_dict.h"
#include "upb/python/map.h"
#include "upb/python/message.h"
#include "upb/python/repeated.h"
#include "upb/python/unknown_fields.h"
static upb_Arena* PyUpb_NewArena(void);

@ -33,9 +33,9 @@
#include <stdbool.h>
#include "python/descriptor.h"
#include "python/python_api.h"
#include "upb/hash/int_table.h"
#include "upb/python/descriptor.h"
#include "upb/python/python_api.h"
#include "upb/upb/hash/int_table.h"
// begin:github_only
#define PYUPB_PROTOBUF_PUBLIC_PACKAGE "google.protobuf"

@ -18,24 +18,24 @@ def py_extension(name, srcs, copts, deps = [], **kwargs):
copts = copts + ["-fvisibility=hidden"],
linkopts = selects.with_or({
(
"//python/dist:osx_x86_64",
"//python/dist:osx_aarch64",
"//upb/python/dist:osx_x86_64",
"//upb/python/dist:osx_aarch64",
): ["-undefined", "dynamic_lookup"],
"//python/dist:windows_x86_32": ["-static-libgcc"],
"//upb/python/dist:windows_x86_32": ["-static-libgcc"],
"//conditions:default": [],
}),
linkshared = True,
linkstatic = True,
deps = deps + select({
"//python:limited_api_3.7": ["@python-3.7.0//:python_headers"],
"//python:full_api_3.7_win32": ["@nuget_python_i686_3.7.0//:python_full_api"],
"//python:full_api_3.7_win64": ["@nuget_python_x86-64_3.7.0//:python_full_api"],
"//python:full_api_3.8_win32": ["@nuget_python_i686_3.8.0//:python_full_api"],
"//python:full_api_3.8_win64": ["@nuget_python_x86-64_3.8.0//:python_full_api"],
"//python:full_api_3.9_win32": ["@nuget_python_i686_3.9.0//:python_full_api"],
"//python:full_api_3.9_win64": ["@nuget_python_x86-64_3.9.0//:python_full_api"],
"//python:limited_api_3.10_win32": ["@nuget_python_i686_3.10.0//:python_limited_api"],
"//python:limited_api_3.10_win64": ["@nuget_python_x86-64_3.10.0//:python_limited_api"],
"//upb/python:limited_api_3.7": ["@python-3.7.0//:python_headers"],
"//upb/python:full_api_3.7_win32": ["@nuget_python_i686_3.7.0//:python_full_api"],
"//upb/python:full_api_3.7_win64": ["@nuget_python_x86-64_3.7.0//:python_full_api"],
"//upb/python:full_api_3.8_win32": ["@nuget_python_i686_3.8.0//:python_full_api"],
"//upb/python:full_api_3.8_win64": ["@nuget_python_x86-64_3.8.0//:python_full_api"],
"//upb/python:full_api_3.9_win32": ["@nuget_python_i686_3.9.0//:python_full_api"],
"//upb/python:full_api_3.9_win64": ["@nuget_python_x86-64_3.9.0//:python_full_api"],
"//upb/python:limited_api_3.10_win32": ["@nuget_python_i686_3.10.0//:python_limited_api"],
"//upb/python:limited_api_3.10_win64": ["@nuget_python_x86-64_3.10.0//:python_limited_api"],
"//conditions:default": ["@system_python//:python_headers"],
}),
**kwargs
@ -49,12 +49,12 @@ def py_extension(name, srcs, copts, deps = [], **kwargs):
srcs = [":" + name + "_binary"],
outs = [output_file],
cmd = "cp $< $@",
visibility = ["//python:__subpackages__"],
visibility = ["//upb/python:__subpackages__"],
)
native.py_library(
name = name,
data = [output_file],
imports = ["."],
visibility = ["//python:__subpackages__"],
visibility = ["//upb/python:__subpackages__"],
)

@ -28,11 +28,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/repeated.h"
#include "upb/python/repeated.h"
#include "python/convert.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/python/convert.h"
#include "upb/python/message.h"
#include "upb/python/protobuf.h"
static PyObject* PyUpb_RepeatedCompositeContainer_Append(PyObject* _self,
PyObject* value);

@ -33,8 +33,8 @@
#include <stdbool.h>
#include "python/python_api.h"
#include "upb/reflection/def.h"
#include "upb/python/python_api.h"
#include "upb/upb/reflection/def.h"
// Creates a new repeated field stub for field `f` of message object `parent`.
// Precondition: `parent` must be a stub.

@ -28,13 +28,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "python/unknown_fields.h"
#include "upb/python/unknown_fields.h"
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/wire/eps_copy_input_stream.h"
#include "upb/wire/reader.h"
#include "upb/wire/types.h"
#include "upb/python/message.h"
#include "upb/python/protobuf.h"
#include "upb/upb/wire/eps_copy_input_stream.h"
#include "upb/upb/wire/reader.h"
#include "upb/upb/wire/types.h"
// -----------------------------------------------------------------------------
// UnknownFieldSet

@ -33,7 +33,7 @@
#include <stdbool.h>
#include "python/python_api.h"
#include "upb/python/python_api.h"
PyObject* PyUpb_UnknownFields_New(PyObject* msg);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save