Skip to content

Commit

Permalink
add indirection for proto_library
Browse files Browse the repository at this point in the history
  • Loading branch information
markdroth committed Oct 18, 2024
1 parent 786fc8f commit 8dd8773
Show file tree
Hide file tree
Showing 18 changed files with 109 additions and 106 deletions.
9 changes: 9 additions & 0 deletions bazel/grpc_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Contains macros used throughout the repo.

load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
load("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", "ios_test_runner")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@com_google_protobuf//bazel:upb_proto_library.bzl", "upb_proto_library", "upb_proto_reflection_library")
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("//bazel:copts.bzl", "GRPC_DEFAULT_COPTS")
Expand Down Expand Up @@ -234,6 +235,14 @@ def grpc_proto_plugin(name, srcs = [], deps = []):
deps = deps,
)

def grpc_internal_proto_library(name, srcs = [], deps = [], visibility = None):
proto_library(
name = name,
srcs = srcs,
deps = deps,
visibility = visibility,
)

def grpc_cc_proto_library(name, deps = [], visibility = None):
native.cc_proto_library(name = name, deps = deps, visibility = visibility)

Expand Down
5 changes: 2 additions & 3 deletions src/proto/grpc/channelz/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_internal_proto_library", "grpc_package")

licenses(["notice"])

Expand All @@ -22,7 +21,7 @@ grpc_package(
visibility = "public",
)

proto_library(
grpc_internal_proto_library(
name = "channelz_proto",
srcs = ["channelz.proto"],
deps = [
Expand Down
5 changes: 2 additions & 3 deletions src/proto/grpc/health/v1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_internal_proto_library", "grpc_package")

licenses(["notice"])

Expand All @@ -22,7 +21,7 @@ grpc_package(
visibility = "public",
)

proto_library(
grpc_internal_proto_library(
name = "health_proto",
srcs = ["health.proto"],
)
Expand Down
7 changes: 3 additions & 4 deletions src/proto/grpc/lb/v1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_internal_proto_library", "grpc_package")

licenses(["notice"])

Expand All @@ -22,7 +21,7 @@ grpc_package(
visibility = "public",
)

proto_library(
grpc_internal_proto_library(
name = "load_balancer_proto",
srcs = ["load_balancer.proto"],
deps = [
Expand All @@ -42,7 +41,7 @@ grpc_cc_grpc_library(
deps = ["load_balancer_cc_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "load_reporter_proto",
srcs = ["load_reporter.proto"],
deps = [
Expand Down
7 changes: 3 additions & 4 deletions src/proto/grpc/lookup/v1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_internal_proto_library", "grpc_package")

licenses(["notice"])

Expand All @@ -22,7 +21,7 @@ grpc_package(
visibility = "public",
)

proto_library(
grpc_internal_proto_library(
name = "rls_proto",
srcs = ["rls.proto"],
)
Expand All @@ -38,7 +37,7 @@ grpc_cc_grpc_library(
deps = ["rls_cc_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "rls_config_proto",
srcs = ["rls_config.proto"],
deps = [
Expand Down
5 changes: 2 additions & 3 deletions src/proto/grpc/reflection/v1/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_internal_proto_library", "grpc_package")

licenses(["notice"])

Expand All @@ -22,7 +21,7 @@ grpc_package(
visibility = "public",
)

proto_library(
grpc_internal_proto_library(
name = "reflection_proto",
srcs = ["reflection.proto"],
)
Expand Down
5 changes: 2 additions & 3 deletions src/proto/grpc/reflection/v1alpha/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_internal_proto_library", "grpc_package")

licenses(["notice"])

Expand All @@ -22,7 +21,7 @@ grpc_package(
visibility = "public",
)

proto_library(
grpc_internal_proto_library(
name = "reflection_proto",
srcs = ["reflection.proto"],
)
Expand Down
4 changes: 2 additions & 2 deletions src/proto/grpc/status/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:grpc_build_system.bzl", "grpc_cc_proto_library", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_proto_library", "grpc_internal_proto_library", "grpc_package")

licenses(["notice"])

Expand All @@ -21,7 +21,7 @@ grpc_package(
visibility = "public",
)

proto_library(
grpc_internal_proto_library(
name = "status_proto",
srcs = ["status.proto"],
deps = [
Expand Down
32 changes: 16 additions & 16 deletions src/proto/grpc/testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_proto//proto:defs.bzl", "proto_library")
load(
"//bazel:grpc_build_system.bzl",
"grpc_cc_grpc_library",
"grpc_cc_proto_library",
"grpc_internal_proto_library",
"grpc_package",
"grpc_proto_library",
)
Expand All @@ -38,7 +38,7 @@ exports_files([
"test.proto",
])

proto_library(
grpc_internal_proto_library(
name = "compiler_test_proto",
srcs = ["compiler_test.proto"],
)
Expand All @@ -55,7 +55,7 @@ grpc_cc_grpc_library(
deps = ["compiler_test_cc_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "control_proto",
srcs = ["control.proto"],
deps = [
Expand All @@ -75,7 +75,7 @@ py_proto_library(
deps = [":control_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "echo_messages_proto",
srcs = ["echo_messages.proto"],
deps = [
Expand All @@ -88,7 +88,7 @@ grpc_cc_proto_library(
deps = ["echo_messages_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "echo_proto",
srcs = ["echo.proto"],
deps = [
Expand All @@ -113,7 +113,7 @@ grpc_cc_grpc_library(
],
)

proto_library(
grpc_internal_proto_library(
name = "empty_proto",
srcs = ["empty.proto"],
)
Expand All @@ -134,7 +134,7 @@ py_grpc_library(
deps = [":empty_py_pb2"],
)

proto_library(
grpc_internal_proto_library(
name = "messages_proto",
srcs = ["messages.proto"],
)
Expand All @@ -155,7 +155,7 @@ py_grpc_library(
deps = [":py_messages_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "metrics_proto",
srcs = ["metrics.proto"],
)
Expand All @@ -171,7 +171,7 @@ grpc_cc_grpc_library(
deps = ["metrics_cc_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "payloads_proto",
srcs = ["payloads.proto"],
)
Expand All @@ -186,7 +186,7 @@ py_proto_library(
deps = [":payloads_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "benchmark_service_proto",
srcs = ["benchmark_service.proto"],
deps = [
Expand Down Expand Up @@ -219,7 +219,7 @@ py_grpc_library(
deps = [":benchmark_service_py_pb2"],
)

proto_library(
grpc_internal_proto_library(
name = "report_qps_scenario_service_proto",
srcs = ["report_qps_scenario_service.proto"],
deps = [
Expand All @@ -241,7 +241,7 @@ grpc_cc_grpc_library(
],
)

proto_library(
grpc_internal_proto_library(
name = "worker_service_proto",
srcs = ["worker_service.proto"],
deps = [
Expand Down Expand Up @@ -274,7 +274,7 @@ py_grpc_library(
deps = [":worker_service_py_pb2"],
)

proto_library(
grpc_internal_proto_library(
name = "simple_messages_proto",
srcs = ["simple_messages.proto"],
)
Expand All @@ -284,7 +284,7 @@ grpc_cc_proto_library(
deps = [":simple_messages_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "stats_proto",
srcs = ["stats.proto"],
)
Expand All @@ -299,7 +299,7 @@ py_proto_library(
deps = [":stats_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "test_proto",
srcs = ["test.proto"],
deps = [
Expand Down Expand Up @@ -330,7 +330,7 @@ py_grpc_library(
deps = [":py_test_proto"],
)

proto_library(
grpc_internal_proto_library(
name = "istio_echo_proto",
srcs = ["istio_echo.proto"],
deps = [
Expand Down
4 changes: 2 additions & 2 deletions src/proto/grpc/testing/duplicate/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_grpc_library", "grpc_cc_proto_library", "grpc_internal_proto_library", "grpc_package")

licenses(["notice"])

Expand All @@ -21,7 +21,7 @@ grpc_package(
visibility = "public",
)

proto_library(
grpc_internal_proto_library(
name = "echo_duplicate_proto",
srcs = ["echo_duplicate.proto"],
deps = ["//src/proto/grpc/testing:echo_messages_proto"],
Expand Down
Loading

0 comments on commit 8dd8773

Please sign in to comment.