-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding grpc-gateway to generate bff reporting definitions (#1006)
This is to create the proto messages for gRPC-Gateway. gRPC-Gateway uses a Go gateway, so these messages will be converted to Go. The Kotlin messages will be added later when setting up the gRPC service (not the gateway). Right now the BFF proto messages are exactly the same as the Reporting service v2alpha messages. This will surely change, but we're still working out how the UI will look and not sure how to make those messages yet. So for now, just going to use the existing proto definitions to put something here.
- Loading branch information
1 parent
5b78087
commit 0ded775
Showing
9 changed files
with
782 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") | ||
load("@io_bazel_rules_go//proto/wkt:well_known_types.bzl", "PROTO_RUNTIME_DEPS", "WELL_KNOWN_TYPES_APIV2") | ||
|
||
go_proto_compiler( | ||
name = "go_apiv2", | ||
options = [ | ||
"paths=source_relative", | ||
], | ||
plugin = "@org_golang_google_protobuf//cmd/protoc-gen-go", | ||
suffix = ".pb.go", | ||
visibility = ["//visibility:public"], | ||
deps = PROTO_RUNTIME_DEPS + WELL_KNOWN_TYPES_APIV2, | ||
) | ||
|
||
go_proto_compiler( | ||
name = "go_grpc", | ||
options = [ | ||
"paths=source_relative", | ||
"require_unimplemented_servers=false", | ||
], | ||
plugin = "@org_golang_google_grpc_cmd_protoc_gen_go_grpc//:protoc-gen-go-grpc", | ||
suffix = "_grpc.pb.go", | ||
visibility = ["//visibility:public"], | ||
deps = PROTO_RUNTIME_DEPS + [ | ||
"@org_golang_google_grpc//:go_default_library", | ||
"@org_golang_google_grpc//codes:go_default_library", | ||
"@org_golang_google_grpc//status:go_default_library", | ||
], | ||
) | ||
|
||
go_proto_compiler( | ||
name = "go_grpc_gateway", | ||
options = ["logtostderr=true"], | ||
plugin = "@protoc_gen_grpc_gateway//file", | ||
suffix = ".pb.gw.go", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@com_github_golang_protobuf//descriptor:go_default_library_gen", | ||
"@go_googleapis//google/api:annotations_go_proto", | ||
"@grpc_ecosystem_grpc_gateway//runtime:go_default_library", | ||
"@grpc_ecosystem_grpc_gateway//utilities:go_default_library", | ||
"@org_golang_google_grpc//:go_default_library", | ||
"@org_golang_google_grpc//codes:go_default_library", | ||
"@org_golang_google_grpc//grpclog:go_default_library", | ||
"@org_golang_google_grpc//metadata:go_default_library", | ||
"@org_golang_google_grpc//status:go_default_library", | ||
"@org_golang_google_protobuf//proto:go_default_library", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2020 The Cross-Media Measurement Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Build defs for gRPC Gateway.""" | ||
|
||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") | ||
|
||
def go_grpc_gateway_proto_library(name, visibility = None, **kwargs): | ||
go_proto_library( | ||
name = name, | ||
compilers = [ | ||
"//build/grpc_gateway:go_apiv2", | ||
"//build/grpc_gateway:go_grpc", | ||
"//build/grpc_gateway:go_grpc_gateway", | ||
], | ||
visibility = visibility, | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/main/proto/wfa/measurement/reporting/bff/v1alpha/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
load("@rules_proto//proto:defs.bzl", "proto_library") | ||
load("//build/grpc_gateway:defs.bzl", "go_grpc_gateway_proto_library") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
IMPORT_PREFIX = "/src/main/proto" | ||
|
||
GO_IMPORT_PATH = "wfa/measurement/reporting/bff/v1alpha/reportingpb" | ||
|
||
proto_library( | ||
name = "metric_proto", | ||
srcs = [ | ||
"metric.proto", | ||
], | ||
strip_import_prefix = IMPORT_PREFIX, | ||
deps = [ | ||
":time_interval_proto", | ||
"@com_google_googleapis//google/api:field_behavior_proto", | ||
"@com_google_googleapis//google/api:resource_proto", | ||
"@com_google_protobuf//:timestamp_proto", | ||
], | ||
) | ||
|
||
proto_library( | ||
name = "time_interval_proto", | ||
srcs = [ | ||
"time_interval.proto", | ||
], | ||
strip_import_prefix = IMPORT_PREFIX, | ||
deps = [ | ||
"@com_google_googleapis//google/api:field_behavior_proto", | ||
"@com_google_protobuf//:duration_proto", | ||
"@com_google_protobuf//:timestamp_proto", | ||
], | ||
) | ||
|
||
proto_library( | ||
name = "report_proto", | ||
srcs = [ | ||
"report.proto", | ||
], | ||
strip_import_prefix = IMPORT_PREFIX, | ||
deps = [ | ||
":metric_proto", | ||
":time_interval_proto", | ||
"@com_google_googleapis//google/api:field_behavior_proto", | ||
"@com_google_googleapis//google/api:resource_proto", | ||
"@com_google_protobuf//:timestamp_proto", | ||
], | ||
) | ||
|
||
proto_library( | ||
name = "reports_service_proto", | ||
srcs = ["reports_service.proto"], | ||
strip_import_prefix = IMPORT_PREFIX, | ||
deps = [ | ||
":report_proto", | ||
"@com_google_googleapis//google/api:annotations_proto", | ||
"@com_google_googleapis//google/api:client_proto", | ||
"@com_google_googleapis//google/api:field_behavior_proto", | ||
"@com_google_googleapis//google/api:resource_proto", | ||
], | ||
) | ||
|
||
go_grpc_gateway_proto_library( | ||
name = "metric_go_proto", | ||
embed = [":time_interval_go_proto"], | ||
importpath = GO_IMPORT_PATH, | ||
protos = [":metric_proto"], | ||
) | ||
|
||
go_grpc_gateway_proto_library( | ||
name = "time_interval_go_proto", | ||
importpath = GO_IMPORT_PATH, | ||
protos = [":time_interval_proto"], | ||
) | ||
|
||
go_grpc_gateway_proto_library( | ||
name = "report_go_proto", | ||
embed = [":metric_go_proto"], | ||
importpath = GO_IMPORT_PATH, | ||
protos = [":report_proto"], | ||
) | ||
|
||
go_grpc_gateway_proto_library( | ||
name = "reports_service_go_proto", | ||
embed = [":report_go_proto"], | ||
importpath = GO_IMPORT_PATH, | ||
protos = [":reports_service_proto"], | ||
) |
Oops, something went wrong.