Skip to content

Commit

Permalink
go proto: include vtprotobuf generation
Browse files Browse the repository at this point in the history
See envoyproxy/go-control-plane#824 for more
information

Signed-off-by: John Howard <howardjohn@google.com>
  • Loading branch information
howardjohn committed Jan 16, 2024
1 parent d7ef6c0 commit 238d30f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
9 changes: 9 additions & 0 deletions api/bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ go_proto_compiler(
visibility = ["//visibility:public"],
)

go_proto_compiler(
name = "vtprotobuf_plugin_go",
options = ["features=marshal_strict+size"],
plugin = "@com_github_planetscale_vtprotobuf//cmd/protoc-gen-go-vtproto",
suffix = "_vtproto.pb.go",
valid_archive = False,
visibility = ["//visibility:public"],
)

json_data(
name = "repository_locations",
data = load_repository_locations_spec(REPOSITORY_LOCATIONS_SPEC),
Expand Down
11 changes: 9 additions & 2 deletions api/bazel/api_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ def api_proto_package(
has_services = has_services,
)

compilers = ["@io_bazel_rules_go//proto:go_proto", "@envoy_api//bazel:pgv_plugin_go"]
compilers = ["@io_bazel_rules_go//proto:go_proto", "@envoy_api//bazel:pgv_plugin_go", "@envoy_api//bazel:vtprotobuf_plugin_go"]
if has_services:
compilers = ["@io_bazel_rules_go//proto:go_grpc", "@envoy_api//bazel:pgv_plugin_go"]
compilers = ["@io_bazel_rules_go//proto:go_grpc", "@envoy_api//bazel:pgv_plugin_go", "@envoy_api//bazel:vtprotobuf_plugin_go"]

deps = (
[_go_proto_mapping(dep) for dep in deps] +
Expand All @@ -162,6 +162,13 @@ def api_proto_package(
"@io_bazel_rules_go//proto/wkt:struct_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@io_bazel_rules_go//proto/wkt:wrappers_go_proto",
"@com_github_planetscale_vtprotobuf//types/known/anypb",
"@com_github_planetscale_vtprotobuf//types/known/durationpb",
"@com_github_planetscale_vtprotobuf//types/known/emptypb",
"@com_github_planetscale_vtprotobuf//types/known/fieldmaskpb",
"@com_github_planetscale_vtprotobuf//types/known/structpb",
"@com_github_planetscale_vtprotobuf//types/known/timestamppb",
"@com_github_planetscale_vtprotobuf//types/known/wrapperspb",
]
)
go_proto_library(
Expand Down
7 changes: 7 additions & 0 deletions bazel/dependency_imports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ def envoy_dependency_imports(go_version = GO_VERSION, jq_version = JQ_VERSION, y
# use_category = ["api"],
# source = "https://github.com/bufbuild/protoc-gen-validate/blob/v0.6.1/dependencies.bzl#L23-L28"
)
go_repository(
name = "com_github_planetscale_vtprotobuf",
importpath = "github.com/planetscale/vtprotobuf",
sum = "h1:nve54OLsoKDQhb8ZnnHHUyvAK3vjBiwTEJeC3UsqzJ8=",
version = "v0.5.1-0.20231205081218-d930d8ac92f8",
build_external = "external",
)

protoc_gen_jsonschema_go_dependencies()

Expand Down

0 comments on commit 238d30f

Please sign in to comment.