-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gRPC gateway Bazel build rules #66
Comments
@achew22 No, I don't have a good example since I am just trying Bazel in a small project which does not use grpc-gateway. |
The following is from a project that's not opensourced (yet), so I can't point to the exact rules. One limiting factor is that I also have custom Go rules (based on Kythe's rules) and haven't gotten around to reworking Bazel's Go rules (see bazelbuild/bazel#828). Because the build rule for Instead I'll try to describe my approach enough to get interested people started. This is my genrule(
name = "scheduler_pb_gw",
srcs = [
"scheduler.proto",
"//vendor:github.com/gengo/grpc-gateway/third_party/googleapis/google/api/annotations.proto",
"//vendor:github.com/gengo/grpc-gateway/third_party/googleapis/google/api/http.proto",
"//vendor:github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto"],
outs = ["scheduler.pb.gw.go"],
cmd = (
"$(location @protobuf//:protoc) " +
" --grpc-gateway_out=logtostderr=true:$$(dirname $@)" +
" -I$$(dirname $$(dirname $$(dirname $(location //vendor:github.com/gengo/grpc-gateway/third_party/googleapis/google/api/annotations.proto)))):$$(dirname $$(dirname $$(dirname $(location //vendor:github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto)))):." +
" --plugin=protoc-gen-grpc-gateway=$(location //vendor:protoc-gen-grpc-gateway)" +
" --proto_path=$$(dirname $(location scheduler.proto)):$$(dirname \"$@\")" +
" $(location scheduler.proto); mv \"$$(dirname \"$@\")\"/scheduler/\"$$(basename \"$@\")\" \"$@\""),
message = "Processing proto file with grpc-gateway",
tools = [
"@protobuf//:protoc",
"//vendor:protoc-gen-grpc-gateway",
]
) The local_repository(
name = "protobuf",
path = __workspace_dir__ + "/vendor/github.com/google/protobuf",
) I'm using a |
@ivucica Thank you for sharing that. Although I'm not going to write the skylark rule by myself very soon, but it is definitely on my to-do list. |
I've posted a preliminary implementation of grpc_gateway_proto_library in rules_protobuf that:
Hopefully we can accomplish easy grpc-gateway support in bazel. Feedback or contributions welcome. |
…ctionSign add transaction sign api
I'm using the normal bazel go rules (http://bazel.io/docs/be/go.html) and I've started looking into creating a build rule for Bazel so the output from grpc-gateway can be depended upon directly. I have a sneaking suspicion that you're using Bazel in some of your projects. Do you have any tricks/tips for getting everything set up in Bazel? Would you be willing to put a sample in the examples folder of how you're doing this?
The text was updated successfully, but these errors were encountered: