diff --git a/src/go/rpk/pkg/serde/embed/BUILD b/src/go/rpk/pkg/serde/embed/BUILD index 303033b8187c0..8379df6cdbb4a 100644 --- a/src/go/rpk/pkg/serde/embed/BUILD +++ b/src/go/rpk/pkg/serde/embed/BUILD @@ -32,7 +32,7 @@ go_test( name = "embed_test", size = "small", srcs = ["embed_test.go"], - data = ["//src/v/pandaproxy:schema_registry_protos"], + data = ["//src/v/pandaproxy/schema_registry/protobuf:schema_registry_protos"], embed = [":embed"], deps = ["@com_github_stretchr_testify//require"], ) diff --git a/src/go/rpk/pkg/serde/embed/embed_test.go b/src/go/rpk/pkg/serde/embed/embed_test.go index e96c728f3d0b9..e5003ab433f0d 100644 --- a/src/go/rpk/pkg/serde/embed/embed_test.go +++ b/src/go/rpk/pkg/serde/embed/embed_test.go @@ -12,7 +12,7 @@ import ( func TestEmbeddedFiles(t *testing.T) { t.Run("Test Embedded files in rpk, equal to Redpanda", func(t *testing.T) { // /src/v/pandaproxy/schema_registry/protobuf - redpandaProtoFS := os.DirFS("../../../../../v/pandaproxy/schema_registry/protobuf/") + redpandaProtoFS := os.DirFS("../../../../../v/pandaproxy/schema_registry/protobuf/_virtual_imports/schema_registry_protos") redpandaMap := make(map[string]string) err := fs.WalkDir(redpandaProtoFS, ".", func(path string, d fs.DirEntry, err error) error { if err != nil { diff --git a/src/v/pandaproxy/BUILD b/src/v/pandaproxy/BUILD index 5f523b5fc0c7e..d321baa364d37 100644 --- a/src/v/pandaproxy/BUILD +++ b/src/v/pandaproxy/BUILD @@ -1,4 +1,3 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:build.bzl", "redpanda_cc_library") load("//bazel/thirdparty:seastar.bzl", "seastar_cc_swagger_library") @@ -12,39 +11,6 @@ seastar_cc_swagger_library( src = "api/api-doc/schema_registry.json", ) -proto_library( - name = "schema_registry_protos", - srcs = [ - "schema_registry/protobuf/confluent/meta.proto", - "schema_registry/protobuf/confluent/types/decimal.proto", - "schema_registry/protobuf/google/type/calendar_period.proto", - "schema_registry/protobuf/google/type/color.proto", - "schema_registry/protobuf/google/type/date.proto", - "schema_registry/protobuf/google/type/datetime.proto", - "schema_registry/protobuf/google/type/dayofweek.proto", - "schema_registry/protobuf/google/type/decimal.proto", - "schema_registry/protobuf/google/type/expr.proto", - "schema_registry/protobuf/google/type/fraction.proto", - "schema_registry/protobuf/google/type/interval.proto", - "schema_registry/protobuf/google/type/latlng.proto", - "schema_registry/protobuf/google/type/localized_text.proto", - "schema_registry/protobuf/google/type/money.proto", - "schema_registry/protobuf/google/type/month.proto", - "schema_registry/protobuf/google/type/phone_number.proto", - "schema_registry/protobuf/google/type/postal_address.proto", - "schema_registry/protobuf/google/type/quaternion.proto", - "schema_registry/protobuf/google/type/timeofday.proto", - ], - visibility = ["//src/go/rpk/pkg/serde:__subpackages__"], - deps = [ - "@protobuf//:any_proto", - "@protobuf//:descriptor_proto", - "@protobuf//:duration_proto", - "@protobuf//:timestamp_proto", - "@protobuf//:wrappers_proto", - ], -) - cc_proto_library( name = "descriptor_cc_proto", deps = [ @@ -122,11 +88,6 @@ cc_proto_library( ], ) -cc_proto_library( - name = "schema_registry_cc_proto", - deps = [":schema_registry_protos"], -) - redpanda_cc_library( name = "pandaproxy", srcs = [ @@ -233,7 +194,6 @@ redpanda_cc_library( ":empty_cc_proto", ":field_mask_cc_proto", ":rest_swagger", - ":schema_registry_cc_proto", ":schema_registry_swagger", ":source_context_cc_proto", ":struct_cc_proto", @@ -266,6 +226,7 @@ redpanda_cc_library( "//src/v/metrics", "//src/v/model", "//src/v/net", + "//src/v/pandaproxy/schema_registry/protobuf:schema_registry_cc_proto", "//src/v/random:time_jitter", "//src/v/reflection:type_traits", "//src/v/rpc", diff --git a/src/v/pandaproxy/schema_registry/CMakeLists.txt b/src/v/pandaproxy/schema_registry/CMakeLists.txt index f926b33ec5205..3c6bf05809542 100644 --- a/src/v/pandaproxy/schema_registry/CMakeLists.txt +++ b/src/v/pandaproxy/schema_registry/CMakeLists.txt @@ -44,9 +44,6 @@ v_cc_library( jsoncons ) -set_source_files_properties(protobuf.cc - PROPERTIES INCLUDE_DIRECTORIES ${PROJECT_BINARY_DIR}) - add_subdirectory(test) add_subdirectory(requests) add_subdirectory(protobuf) diff --git a/src/v/pandaproxy/schema_registry/protobuf.cc b/src/v/pandaproxy/schema_registry/protobuf.cc index a0ff8f5244bdc..5e53766357e47 100644 --- a/src/v/pandaproxy/schema_registry/protobuf.cc +++ b/src/v/pandaproxy/schema_registry/protobuf.cc @@ -18,25 +18,6 @@ #include "pandaproxy/schema_registry/compatibility.h" #include "pandaproxy/schema_registry/errors.h" #include "pandaproxy/schema_registry/sharded_store.h" -#include "src/v/pandaproxy/schema_registry/protobuf/confluent/meta.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/confluent/types/decimal.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/calendar_period.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/color.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/date.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/datetime.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/dayofweek.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/decimal.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/expr.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/fraction.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/interval.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/latlng.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/localized_text.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/money.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/month.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/phone_number.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/postal_address.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/quaternion.pb.h" -#include "src/v/pandaproxy/schema_registry/protobuf/google/type/timeofday.pb.h" #include "ssx/sformat.h" #include "thirdparty/protobuf/descriptor.h" #include "thirdparty/protobuf/descriptor.pb.h" @@ -47,6 +28,8 @@ #include #include +#include +#include #include #include #include @@ -62,6 +45,23 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/src/v/pandaproxy/schema_registry/protobuf/BUILD b/src/v/pandaproxy/schema_registry/protobuf/BUILD new file mode 100644 index 0000000000000..71b9da26827c5 --- /dev/null +++ b/src/v/pandaproxy/schema_registry/protobuf/BUILD @@ -0,0 +1,41 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +proto_library( + name = "schema_registry_protos", + srcs = [ + "confluent/meta.proto", + "confluent/types/decimal.proto", + "google/type/calendar_period.proto", + "google/type/color.proto", + "google/type/date.proto", + "google/type/datetime.proto", + "google/type/dayofweek.proto", + "google/type/decimal.proto", + "google/type/expr.proto", + "google/type/fraction.proto", + "google/type/interval.proto", + "google/type/latlng.proto", + "google/type/localized_text.proto", + "google/type/money.proto", + "google/type/month.proto", + "google/type/phone_number.proto", + "google/type/postal_address.proto", + "google/type/quaternion.proto", + "google/type/timeofday.proto", + ], + strip_import_prefix = "/src/v/pandaproxy/schema_registry/protobuf/", + visibility = ["//visibility:public"], + deps = [ + "@protobuf//:any_proto", + "@protobuf//:descriptor_proto", + "@protobuf//:duration_proto", + "@protobuf//:timestamp_proto", + "@protobuf//:wrappers_proto", + ], +) + +cc_proto_library( + name = "schema_registry_cc_proto", + visibility = ["//visibility:public"], + deps = [":schema_registry_protos"], +) diff --git a/src/v/pandaproxy/schema_registry/test/BUILD b/src/v/pandaproxy/schema_registry/test/BUILD index 74c153da063c1..f56aab8e2151e 100644 --- a/src/v/pandaproxy/schema_registry/test/BUILD +++ b/src/v/pandaproxy/schema_registry/test/BUILD @@ -221,6 +221,28 @@ redpanda_cc_btest( ], ) +redpanda_cc_btest( + name = "compatibility_protobuf_test", + timeout = "short", + srcs = [ + "compatibility_protobuf.cc", + ], + cpu = 1, + data = [ + ], + deps = [ + "//src/v/pandaproxy", + "//src/v/pandaproxy/schema_registry/test:compatibility_common", + "//src/v/pandaproxy/schema_registry/test:compatibility_protobuf", + "//src/v/test_utils:seastar_boost", + "@abseil-cpp//absl/container:flat_hash_set", + "@boost//:test", + "@fmt", + "@seastar", + "@seastar//:testing", + ], +) + redpanda_cc_btest( name = "compatibility_avro_test", timeout = "short",