Skip to content

Commit

Permalink
Merge pull request #24775 from IoannisRP/ik-pandaproxy-protobuf-refactor
Browse files Browse the repository at this point in the history
protobuf: move proto files to schema/protobuf
  • Loading branch information
IoannisRP authored Jan 14, 2025
2 parents 2ccbf0d + 8fe02fd commit 64eca11
Show file tree
Hide file tree
Showing 29 changed files with 61 additions and 104 deletions.
5 changes: 4 additions & 1 deletion src/go/rpk/pkg/serde/embed/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ go_test(
name = "embed_test",
size = "small",
srcs = ["embed_test.go"],
data = ["//src/v/pandaproxy/schema_registry/protobuf:schema_registry_proto_files"],
data = [
"//src/v/schema/protobuf:confluent_type_proto_files",
"//src/v/schema/protobuf:google_type_proto_files",
],
embed = [":embed"],
deps = ["@com_github_stretchr_testify//require"],
)
2 changes: 1 addition & 1 deletion src/go/rpk/pkg/serde/embed/embed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/schema/protobuf")
redpandaMap := make(map[string]string)
err := fs.WalkDir(redpandaProtoFS, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
Expand Down
94 changes: 4 additions & 90 deletions src/v/pandaproxy/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("//bazel:build.bzl", "redpanda_cc_library")
load("//bazel/thirdparty:seastar.bzl", "seastar_cc_swagger_library")
load("//src/v/schema/protobuf:well_known.bzl", "well_known_cc_protos")

seastar_cc_swagger_library(
name = "rest_swagger",
Expand All @@ -11,83 +12,6 @@ seastar_cc_swagger_library(
src = "api/api-doc/schema_registry.json",
)

cc_proto_library(
name = "descriptor_cc_proto",
deps = [
"@protobuf//:descriptor_proto",
],
)

cc_proto_library(
name = "struct_cc_proto",
deps = [
"@protobuf//:struct_proto",
],
)

cc_proto_library(
name = "field_mask_cc_proto",
deps = [
"@protobuf//:field_mask_proto",
],
)

cc_proto_library(
name = "source_context_cc_proto",
deps = [
"@protobuf//:source_context_proto",
],
)

cc_proto_library(
name = "timestamp_cc_proto",
deps = [
"@protobuf//:timestamp_proto",
],
)

cc_proto_library(
name = "type_cc_proto",
deps = [
"@protobuf//:type_proto",
],
)

cc_proto_library(
name = "wrappers_cc_proto",
deps = [
"@protobuf//:wrappers_proto",
],
)

cc_proto_library(
name = "api_cc_proto",
deps = [
"@protobuf//:api_proto",
],
)

cc_proto_library(
name = "duration_cc_proto",
deps = [
"@protobuf//:duration_proto",
],
)

cc_proto_library(
name = "empty_cc_proto",
deps = [
"@protobuf//:empty_proto",
],
)

cc_proto_library(
name = "any_cc_proto",
deps = [
"@protobuf//:any_proto",
],
)

redpanda_cc_library(
name = "pandaproxy",
srcs = [
Expand Down Expand Up @@ -186,21 +110,10 @@ redpanda_cc_library(
include_prefix = "pandaproxy",
visibility = ["//visibility:public"],
deps = [
":any_cc_proto",
":api_cc_proto",
":config",
":descriptor_cc_proto",
":duration_cc_proto",
":empty_cc_proto",
":field_mask_cc_proto",
":rest_swagger",
":schema_registry_swagger",
":source_context_cc_proto",
":struct_cc_proto",
":subject_name_strategy",
":timestamp_cc_proto",
":type_cc_proto",
":wrappers_cc_proto",
"//src/v/base",
"//src/v/bytes:iobuf",
"//src/v/bytes:iobuf_parser",
Expand All @@ -226,10 +139,11 @@ 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",
"//src/v/schema/protobuf:confluent_type_cc_proto",
"//src/v/schema/protobuf:google_type_cc_proto",
"//src/v/security",
"//src/v/security:request_auth",
"//src/v/security/audit",
Expand Down Expand Up @@ -274,7 +188,7 @@ redpanda_cc_library(
"@rapidjson",
"@re2",
"@seastar",
],
] + well_known_cc_protos,
)

redpanda_cc_library(
Expand Down
2 changes: 0 additions & 2 deletions src/v/pandaproxy/schema_registry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ seastar_generate_swagger(
OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/../api/api-doc/
)

find_package(Protobuf REQUIRED)
find_package(Avro)
find_package(jsoncons REQUIRED)

Expand Down Expand Up @@ -46,4 +45,3 @@ v_cc_library(

add_subdirectory(test)
add_subdirectory(requests)
add_subdirectory(protobuf)
1 change: 1 addition & 0 deletions src/v/schema/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ v_cc_library(
)

add_subdirectory(tests)
add_subdirectory(protobuf)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

filegroup(
name = "schema_registry_proto_files",
name = "google_type_proto_files",
srcs = [
"confluent/meta.proto",
"confluent/types/decimal.proto",
"google/type/calendar_period.proto",
"google/type/color.proto",
"google/type/date.proto",
Expand All @@ -27,21 +25,46 @@ filegroup(
)

proto_library(
name = "schema_registry_protos",
srcs = [":schema_registry_proto_files"],
strip_import_prefix = "/src/v/pandaproxy/schema_registry/protobuf/",
name = "google_type_protos",
srcs = [":google_type_proto_files"],
strip_import_prefix = "/src/v/schema/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",
name = "google_type_cc_proto",
visibility = ["//visibility:public"],
deps = [":google_type_protos"],
)

filegroup(
name = "confluent_type_proto_files",
srcs = [
"confluent/meta.proto",
"confluent/types/decimal.proto",
],
visibility = ["//visibility:public"],
)

proto_library(
name = "confluent_type_protos",
srcs = [
":confluent_type_proto_files",
],
strip_import_prefix = "/src/v/schema/protobuf/",
visibility = ["//visibility:public"],
deps = [
"@protobuf//:descriptor_proto",
],
)

cc_proto_library(
name = "confluent_type_cc_proto",
visibility = ["//visibility:public"],
deps = [":schema_registry_protos"],
deps = [":confluent_type_protos"],
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
find_package(Protobuf REQUIRED)

set(PROTO_FILES
confluent/meta.proto
confluent/types/decimal.proto
Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions src/v/schema/protobuf/well_known.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
This module contains definitions to group all google well_known proto types
"""

well_known_cc_protos = [
"@protobuf//:any_cc_proto",
"@protobuf//:api_cc_proto",
"@protobuf//:duration_cc_proto",
"@protobuf//:empty_cc_proto",
"@protobuf//:field_mask_cc_proto",
"@protobuf//:source_context_cc_proto",
"@protobuf//:struct_cc_proto",
"@protobuf//:timestamp_cc_proto",
"@protobuf//:type_cc_proto",
"@protobuf//:wrappers_cc_proto",
]

0 comments on commit 64eca11

Please sign in to comment.