@@ -0,0 +1,1194 @@
+proto_filetype = FileType(%5B%22.proto%22%5D)%0A%0Adef proto_library(name, src, deps = None,%0A                  generate_cc = True,%0A                  generate_python = True,%0A                  has_service = True):%0A  if has_service:%0A    proto_cc_deps = %5B%0A      %22//third_party/protobuf:protoc%22,%0A      %22//third_party/grpc:grpc_cpp_plugin%22%0A    %5D%0A    cc_deps = %5B%0A      %22//third_party/protobuf:cc_proto%22,%0A      %22//third_party/grpc:grpc++%22%0A    %5D%0A  else:%0A    proto_cc_deps = %5B%0A      %22//third_party/protobuf:protoc%22,%0A    %5D%0A    cc_deps = %5B%0A      %22//third_party/protobuf:cc_proto%22%0A    %5D%0A  command = %22$(location //third_party/protobuf:protoc) --cpp_out=$(GENDIR)/%22%0A  if has_service:%0A    command += %22 --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(location //third_party/grpc:grpc_cpp_plugin)%22%0A  command += %22 $(location %25s)%22 %25 (src)%0A%0A  basename = src%5B0:-5%5D%0A  cc_proto_name = name + %22_cc_proto%22%0A  native.genrule(%0A    name = cc_proto_name,%0A    srcs = %5B src %5D + proto_cc_deps,%0A    cmd = command,%0A    outs = %5B%0A      basename + %22pb.h%22,%0A      basename + %22pb.cc%22%0A    %5D,%0A  )%0A  native.cc_library(%0A    name = name,%0A    hdrs = %5B%0A      basename + %22pb.h%22,%0A    %5D,%0A    srcs = %5B%0A      %22:%22 + cc_proto_name%0A    %5D,%0A    deps = cc_deps,%0A  )%0A

Add macro proto_library that calls protoc to generate code for grpc.