Skip to content

Commit

Permalink
cleanup: remove api_version from BUILD files
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 677657197
  • Loading branch information
ericsalo authored and copybara-github committed Oct 2, 2024
1 parent 55916e1 commit f346779
Show file tree
Hide file tree
Showing 23 changed files with 66 additions and 62 deletions.
12 changes: 7 additions & 5 deletions pybind11_protobuf/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pybind_library(
"//visibility:public",
],
deps = [
"@com_google_protobuf//:protobuf",
"//net/proto2/public",
],
)

Expand All @@ -25,8 +25,8 @@ pybind_library(
":check_unknown_fields",
":enum_type_caster",
":proto_cast_util",
"//net/proto2/public",
"@com_google_absl//absl/strings:string_view",
"@com_google_protobuf//:protobuf",
],
)

Expand All @@ -39,6 +39,8 @@ pybind_library(
],
deps = [
":check_unknown_fields",
"//net/proto2/proto:descriptor_cc_proto",
"//net/proto2/public",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
Expand All @@ -58,9 +60,9 @@ pybind_library(
],
deps = [
":proto_cast_util",
"//net/proto2/public",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/types:optional",
"@com_google_protobuf//:protobuf",
],
)

Expand All @@ -69,13 +71,13 @@ cc_library(
srcs = ["check_unknown_fields.cc"],
hdrs = ["check_unknown_fields.h"],
deps = [
"//net/proto2/public",
"//net/proto2/python/public:proto_api",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/meta:type_traits",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization",
"@com_google_protobuf//:protobuf",
"@com_google_protobuf//python:proto_api",
],
)

Expand Down
6 changes: 3 additions & 3 deletions pybind11_protobuf/check_unknown_fields.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <string>
#include <vector>

#include "google/protobuf/descriptor.h"
#include "google/protobuf/message.h"
#include "google/protobuf/unknown_field_set.h"
#include "net/proto2/public/descriptor.h"
#include "net/proto2/public/message.h"
#include "net/proto2/public/unknown_field_set.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "absl/strings/str_cat.h"
Expand Down
4 changes: 2 additions & 2 deletions pybind11_protobuf/check_unknown_fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <optional>

#include "google/protobuf/message.h"
#include "python/google/protobuf/proto_api.h"
#include "net/proto2/public/message.h"
#include "net/proto2/python/public/proto_api.h"
#include "absl/strings/string_view.h"

namespace pybind11_protobuf::check_unknown_fields {
Expand Down
6 changes: 3 additions & 3 deletions pybind11_protobuf/enum_type_caster.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include <string>
#include <type_traits>

#include "google/protobuf/descriptor.h"
#include "google/protobuf/generated_enum_reflection.h"
#include "google/protobuf/generated_enum_util.h"
#include "net/proto2/public/descriptor.h"
#include "net/proto2/public/generated_enum_reflection.h"
#include "net/proto2/public/generated_enum_util.h"

// pybind11 type_caster specialization which translates Proto::Enum types
// to/from ints. This will have ODR conflicts when users specify wrappers for
Expand Down
2 changes: 1 addition & 1 deletion pybind11_protobuf/native_proto_caster.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <type_traits>
#include <utility>

#include "google/protobuf/message.h"
#include "net/proto2/public/message.h"
#include "absl/strings/string_view.h"
#include "pybind11_protobuf/enum_type_caster.h"
#include "pybind11_protobuf/proto_caster_impl.h"
Expand Down
8 changes: 4 additions & 4 deletions pybind11_protobuf/proto_cast_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <utility>
#include <vector>

#include "google/protobuf/descriptor.pb.h"
#include "net/proto2/proto/descriptor.pb.h"
#include "absl/container/flat_hash_map.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
Expand Down Expand Up @@ -183,11 +183,11 @@ GlobalState::GlobalState() {

// pybind11_protobuf casting needs a dependency on proto internals to work.
try {
ImportCached("google.protobuf.descriptor");
ImportCached("google3.net.proto2.python.public.descriptor");
auto descriptor_pool =
ImportCached("google.protobuf.descriptor_pool");
ImportCached("google3.net.proto2.python.public.descriptor_pool");
auto message_factory =
ImportCached("google.protobuf.message_factory");
ImportCached("google3.net.proto2.python.public.message_factory");
global_pool_ = descriptor_pool.attr("Default")();
find_message_type_by_name_ = global_pool_.attr("FindMessageTypeByName");
if (hasattr(message_factory, "GetMessageClass")) {
Expand Down
4 changes: 2 additions & 2 deletions pybind11_protobuf/proto_cast_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <type_traits>
#include <utility>

#include "google/protobuf/descriptor.h"
#include "google/protobuf/message.h"
#include "net/proto2/public/descriptor.h"
#include "net/proto2/public/message.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"

Expand Down
6 changes: 3 additions & 3 deletions pybind11_protobuf/proto_caster_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include <type_traits>
#include <utility>

#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/message.h"
#include "net/proto2/proto/descriptor.pb.h"
#include "net/proto2/public/descriptor.h"
#include "net/proto2/public/message.h"
#include "pybind11_protobuf/proto_cast_util.h"

// Enables unsafe conversions; currently these are a work in progress.
Expand Down
8 changes: 4 additions & 4 deletions pybind11_protobuf/proto_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include <stdexcept>
#include <string>

#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/message.h"
#include "google/protobuf/reflection.h"
#include "net/proto2/proto/descriptor.pb.h"
#include "net/proto2/public/descriptor.h"
#include "net/proto2/public/message.h"
#include "net/proto2/public/reflection.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"

Expand Down
2 changes: 1 addition & 1 deletion pybind11_protobuf/proto_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <memory>

#include "google/protobuf/message.h"
#include "net/proto2/public/message.h"

namespace pybind11 {
namespace google {
Expand Down
16 changes: 9 additions & 7 deletions pybind11_protobuf/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ pybind_extension(
name = "dynamic_message_module",
srcs = ["dynamic_message_module.cc"],
deps = [
"//net/proto2/proto:descriptor_cc_proto",
"//net/proto2/public",
"//pybind11_protobuf:native_proto_caster",
"@com_google_protobuf//:protobuf",
],
)

Expand Down Expand Up @@ -170,7 +171,7 @@ pybind_extension(
":extension_in_other_file_in_deps_cc_proto",
":extension_nest_repeated_cc_proto",
":test_cc_proto",
"@com_google_protobuf//:protobuf",
"//net/proto2/public",
"//pybind11_protobuf:native_proto_caster",
],
)
Expand Down Expand Up @@ -202,8 +203,8 @@ pybind_extension(
srcs = ["message_module.cc"],
deps = [
":test_cc_proto",
"//net/proto2/public",
"//pybind11_protobuf:native_proto_caster",
"@com_google_protobuf//:protobuf",
],
)

Expand Down Expand Up @@ -232,8 +233,9 @@ pybind_extension(
srcs = ["pass_by_module.cc"],
deps = [
":test_cc_proto",
"//net/proto2/proto:descriptor_cc_proto",
"//net/proto2/public",
"//pybind11_protobuf:native_proto_caster",
"@com_google_protobuf//:protobuf",
],
)

Expand All @@ -257,8 +259,8 @@ pybind_extension(
name = "pass_proto2_message_module",
srcs = ["pass_proto2_message_module.cc"],
deps = [
"//net/proto2/public",
"//pybind11_protobuf:native_proto_caster",
"@com_google_protobuf//:protobuf",
],
)

Expand All @@ -269,10 +271,10 @@ pybind_extension(
srcs = ["wrapped_proto_module.cc"],
deps = [
":test_cc_proto",
"//net/proto2/public",
"//pybind11_protobuf:wrapped_proto_caster",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/types:optional",
"@com_google_protobuf//:protobuf",
],
)

Expand Down Expand Up @@ -322,8 +324,8 @@ pybind_extension(
name = "regression_wrappers_module",
srcs = ["regression_wrappers_module.cc"],
deps = [
"//net/proto2/public",
"//pybind11_protobuf:native_proto_caster",
"@com_google_protobuf//:protobuf",
],
)

Expand Down
8 changes: 4 additions & 4 deletions pybind11_protobuf/tests/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def testXXX(self):
import collections.abc as collections_abc
import difflib

from google.protobuf import descriptor
from google.protobuf import descriptor_pool
from google.protobuf import message
from google.protobuf import text_format
from google3.net.proto2.python.public import descriptor
from google3.net.proto2.python.public import descriptor_pool
from google3.net.proto2.python.public import message
from google3.net.proto2.python.public import text_format


def assertProtoEqual(self, a, b, check_initialized=True, # pylint: disable=invalid-name
Expand Down
10 changes: 5 additions & 5 deletions pybind11_protobuf/tests/dynamic_message_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include <memory>
#include <stdexcept>

#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/dynamic_message.h"
#include "google/protobuf/message.h"
#include "google/protobuf/text_format.h"
#include "net/proto2/proto/descriptor.pb.h"
#include "net/proto2/public/descriptor.h"
#include "net/proto2/public/dynamic_message.h"
#include "net/proto2/public/message.h"
#include "net/proto2/public/text_format.h"
#include "pybind11_protobuf/native_proto_caster.h"

namespace py = ::pybind11;
Expand Down
6 changes: 3 additions & 3 deletions pybind11_protobuf/tests/dynamic_message_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from absl.testing import absltest
from absl.testing import parameterized

from google.protobuf import descriptor_pb2
from google.protobuf import descriptor_pool
from google.protobuf import message_factory
from google3.net.proto2.proto import descriptor_pb2
from google3.net.proto2.python.public import descriptor_pool
from google3.net.proto2.python.public import message_factory
from pybind11_protobuf.tests import compare
from pybind11_protobuf.tests import dynamic_message_module as m
from pybind11_protobuf.tests import test_pb2
Expand Down
2 changes: 1 addition & 1 deletion pybind11_protobuf/tests/extension_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <memory>
#include <stdexcept>

#include "google/protobuf/message.h"
#include "net/proto2/public/message.h"
#include "pybind11_protobuf/native_proto_caster.h"
#include "pybind11_protobuf/tests/extension.pb.h"
#include "pybind11_protobuf/tests/extension_nest_repeated.pb.h"
Expand Down
4 changes: 2 additions & 2 deletions pybind11_protobuf/tests/message_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <memory>
#include <stdexcept>

#include "google/protobuf/message.h"
#include "google/protobuf/text_format.h"
#include "net/proto2/public/message.h"
#include "net/proto2/public/text_format.h"
#include "pybind11_protobuf/native_proto_caster.h"
#include "pybind11_protobuf/tests/test.pb.h"

Expand Down
2 changes: 1 addition & 1 deletion pybind11_protobuf/tests/message_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pybind11_protobuf.tests import compare
from pybind11_protobuf.tests import message_module as m
from pybind11_protobuf.tests import test_pb2
from google.protobuf import text_format
from google3.net.proto2.python.public import text_format


def get_py_message():
Expand Down
8 changes: 4 additions & 4 deletions pybind11_protobuf/tests/pass_by_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include <stdexcept>
#include <variant>

#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/dynamic_message.h"
#include "google/protobuf/message.h"
#include "net/proto2/proto/descriptor.pb.h"
#include "net/proto2/public/descriptor.h"
#include "net/proto2/public/dynamic_message.h"
#include "net/proto2/public/message.h"
#include "pybind11_protobuf/native_proto_caster.h"
#include "pybind11_protobuf/tests/test.pb.h"

Expand Down
4 changes: 2 additions & 2 deletions pybind11_protobuf/tests/pass_by_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

from pybind11_protobuf.tests import pass_by_module as m
from pybind11_protobuf.tests import test_pb2
from google.protobuf import descriptor_pool
from google.protobuf import message_factory
from google3.net.proto2.python.public import descriptor_pool
from google3.net.proto2.python.public import message_factory


def get_abstract_pass_by_params():
Expand Down
2 changes: 1 addition & 1 deletion pybind11_protobuf/tests/pass_proto2_message_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <cstddef>

#include "google/protobuf/message.h"
#include "net/proto2/public/message.h"
#include "pybind11_protobuf/native_proto_caster.h"

PYBIND11_MODULE(pass_proto2_message_module, m) {
Expand Down
4 changes: 2 additions & 2 deletions pybind11_protobuf/tests/regression_wrappers_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include <pybind11/pybind11.h>

#include "google/protobuf/descriptor.h"
#include "google/protobuf/message.h"
#include "net/proto2/public/descriptor.h"
#include "net/proto2/public/message.h"
#include "pybind11_protobuf/native_proto_caster.h"

namespace {
Expand Down
2 changes: 1 addition & 1 deletion pybind11_protobuf/tests/wrapped_proto_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stdexcept>
#include <vector>

#include "google/protobuf/dynamic_message.h"
#include "net/proto2/public/dynamic_message.h"
#include "absl/status/statusor.h"
#include "absl/types/optional.h"
#include "pybind11_protobuf/tests/test.pb.h"
Expand Down
2 changes: 1 addition & 1 deletion pybind11_protobuf/wrapped_proto_caster.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <type_traits>
#include <utility>

#include "google/protobuf/message.h"
#include "net/proto2/public/message.h"
#include "absl/status/statusor.h"
#include "absl/types/optional.h"
#include "pybind11_protobuf/proto_cast_util.h"
Expand Down

0 comments on commit f346779

Please sign in to comment.