Skip to content

Commit

Permalink
Bazel rules for Python grpcio_reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwriternr authored and nathanielmanistaatgoogle committed Nov 1, 2018
1 parent d35a7c4 commit e4382ab
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/proto/grpc/reflection/v1alpha/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ grpc_proto_library(
name = "reflection_proto",
srcs = ["reflection.proto"],
)

filegroup(
name = "reflection_proto_file",
srcs = [
"reflection.proto",
],
)

11 changes: 11 additions & 0 deletions src/proto/grpc/testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
licenses(["notice"]) # Apache v2

load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_library")

grpc_package(name = "testing", visibility = "public")

Expand Down Expand Up @@ -58,6 +60,15 @@ grpc_proto_library(
has_services = False,
)

py_proto_library(
name = "py_empty_proto",
protos = ["empty.proto",],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)

grpc_proto_library(
name = "messages_proto",
srcs = ["messages.proto"],
Expand Down
30 changes: 30 additions & 0 deletions src/proto/grpc/testing/proto2/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_library")

package(default_visibility = ["//visibility:public"])

py_proto_library(
name = "empty2_proto",
protos = [
"empty2.proto",
],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)

py_proto_library(
name = "empty2_extensions_proto",
protos = [
"empty2_extensions.proto",
],
proto_deps = [
":empty2_proto",
],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)

34 changes: 34 additions & 0 deletions src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_library")

package(default_visibility = ["//visibility:public"])

genrule(
name = "mv_reflection_proto",
srcs = [
"//src/proto/grpc/reflection/v1alpha:reflection_proto_file",
],
outs = ["reflection.proto",],
cmd = "cp $< $@",
)

py_proto_library(
name = "py_reflection_proto",
protos = [":mv_reflection_proto",],
with_grpc = True,
deps = [
requirement('protobuf'),
],
)

py_library(
name = "grpc_reflection",
srcs = ["reflection.py",],
deps = [
":py_reflection_proto",
"//src/python/grpcio/grpc:grpcio",
requirement('protobuf'),
],
imports=["../../",],
)

21 changes: 21 additions & 0 deletions src/python/grpcio_tests/tests/reflection/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
load("@grpc_python_dependencies//:requirements.bzl", "requirement")

package(default_visibility = ["//visibility:public"])

py_test(
name="_reflection_servicer_test",
size="small",
timeout="moderate",
srcs=["_reflection_servicer_test.py",],
main="_reflection_servicer_test.py",
deps=[
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_reflection/grpc_reflection/v1alpha:grpc_reflection",
"//src/python/grpcio_tests/tests/unit:test_common",
"//src/proto/grpc/testing:py_empty_proto",
"//src/proto/grpc/testing/proto2:empty2_extensions_proto",
requirement('protobuf'),
],
imports=["../../",],
)

0 comments on commit e4382ab

Please sign in to comment.