-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bazel rules for Python grpcio_health_checking
Add Bazel rules for building and testing grpcio_health_checking. An unofficial fork for rules_protobuf is used for now as it incorporates a change (grpc#196 by duduko on the upstream repo pubref/rules_protobuf) which allows the protoc compiler to compile generated protos too. This was not merged because the change was failing for golang, but works as expected for Python. This is needed because grpcio_health_checking fetches it's proto file from a different directory (previously achived through setup.py) and thus needs to be moved to the required location within bazel-genfiles using a genrule.
- Loading branch information
1 parent
912b8ab
commit 873e075
Showing
4 changed files
with
59 additions
and
2 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
33 changes: 33 additions & 0 deletions
33
src/python/grpcio_health_checking/grpc_health/v1/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,33 @@ | ||
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_health_proto", | ||
srcs = [ | ||
"//src/proto/grpc/health/v1:health_proto_file", | ||
], | ||
outs = ["health.proto",], | ||
cmd = "cp $< $@", | ||
) | ||
|
||
py_proto_library( | ||
name = "py_health_proto", | ||
protos = [":mv_health_proto",], | ||
with_grpc = True, | ||
deps = [ | ||
requirement('protobuf'), | ||
], | ||
) | ||
|
||
py_library( | ||
name = "grpc_health", | ||
srcs = ["health.py",], | ||
deps = [ | ||
":py_health_proto", | ||
"//src/python/grpcio/grpc:grpcio", | ||
], | ||
imports=["../../",], | ||
) | ||
|
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,15 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
py_test( | ||
name = "health_servicer_test", | ||
srcs = ["_health_servicer_test.py"], | ||
main = "_health_servicer_test.py", | ||
size = "small", | ||
deps = [ | ||
"//src/python/grpcio/grpc:grpcio", | ||
"//src/python/grpcio_health_checking/grpc_health/v1:grpc_health", | ||
"//src/python/grpcio_tests/tests/unit:test_common", | ||
], | ||
imports = ["../../",], | ||
) | ||
|