Protobuf and gRPC rules for Bazel
Version 3.1.0 has been released with fixes for JavaScript, updated dependencies and new rules for linting and producing documentation from .proto files. See the release notes linked above for all changes.
Version 3.0.0 has been released with updated Protobuf and gRPC versions and a number of major improvements. For some languages this may not be a drop-in replacement and it may be necessary to update your WORKSPACE file due to changes in dependencies; please see the above linked release notes for details or the language specific rules pages. If you discover any problems with the new release, please open a new issue, create a discussion or otherwise check in the #proto channel on Bazel Slack.
Full documentation for the current and previous versions can be found here
Language | Rule | Description |
---|---|---|
Android | android_proto_compile | Generates an Android protobuf .jar file (example) |
Android | android_grpc_compile | Generates Android protobuf and gRPC .jar files (example) |
Android | android_proto_library | Generates an Android protobuf library using android_library from rules_android (example) |
Android | android_grpc_library | Generates Android protobuf and gRPC library using android_library from rules_android (example) |
Buf | buf_proto_breaking_test | Checks .proto files for breaking changes (example) |
Buf | buf_proto_lint_test | Lints .proto files (example) |
C | c_proto_compile | Generates C protobuf .h & .c files (example) |
C | c_proto_library | Generates a C protobuf library using cc_library , with dependencies linked (example) |
C++ | cpp_proto_compile | Generates C++ protobuf .h & .cc files (example) |
C++ | cpp_grpc_compile | Generates C++ protobuf and gRPC .h & .cc files (example) |
C++ | cpp_proto_library | Generates a C++ protobuf library using cc_library , with dependencies linked (example) |
C++ | cpp_grpc_library | Generates a C++ protobuf and gRPC library using cc_library , with dependencies linked (example) |
C# | csharp_proto_compile | Generates C# protobuf .cs files (example) |
C# | csharp_grpc_compile | Generates C# protobuf and gRPC .cs files (example) |
C# | csharp_proto_library | Generates a C# protobuf library using csharp_library from rules_dotnet . Note that the library name must end in .dll (example) |
C# | csharp_grpc_library | Generates a C# protobuf and gRPC library using csharp_library from rules_dotnet . Note that the library name must end in .dll (example) |
D | d_proto_compile | Generates D protobuf .d files (example) |
D | d_proto_library | Generates a D protobuf library using d_library from rules_d (example) |
Documentation | doc_docbook_compile | Generates DocBook .xml documentation file (example) |
Documentation | doc_html_compile | Generates .html documentation file (example) |
Documentation | doc_json_compile | Generates .json documentation file (example) |
Documentation | doc_markdown_compile | Generates Markdown .md documentation file (example) |
Go | go_proto_compile | Generates Go protobuf .go files (example) |
Go | go_grpc_compile | Generates Go protobuf and gRPC .go files (example) |
Go | go_proto_library | Generates a Go protobuf library using go_library from rules_go (example) |
Go | go_grpc_library | Generates a Go protobuf and gRPC library using go_library from rules_go (example) |
grpc-gateway | gateway_grpc_compile | Generates grpc-gateway .go files (example) |
grpc-gateway | gateway_openapiv2_compile | Generates grpc-gateway OpenAPI v2 .json files (example) |
grpc-gateway | gateway_grpc_library | Generates grpc-gateway library files (example) |
Java | java_proto_compile | Generates a Java protobuf srcjar file (example) |
Java | java_grpc_compile | Generates a Java protobuf and gRPC srcjar file (example) |
Java | java_proto_library | Generates a Java protobuf library using java_library (example) |
Java | java_grpc_library | Generates a Java protobuf and gRPC library using java_library (example) |
JavaScript | js_proto_compile | Generates JavaScript protobuf .js and .d.ts files (example) |
JavaScript | js_grpc_node_compile | Generates JavaScript protobuf and gRPC-node .js and .d.ts files (example) |
JavaScript | js_grpc_web_compile | Generates JavaScript protobuf and gRPC-Web .js and .d.ts files (example) |
JavaScript | js_proto_library | Generates a JavaScript protobuf library using js_library from rules_nodejs (example) |
JavaScript | js_grpc_node_library | Generates a Node.js protobuf + gRPC-node library using js_library from rules_nodejs (example) |
JavaScript | js_grpc_web_library | Generates a JavaScript protobuf + gRPC-Web library using js_library from rules_nodejs (example) |
Objective-C | objc_proto_compile | Generates Objective-C protobuf .m & .h files (example) |
Objective-C | objc_grpc_compile | Generates Objective-C protobuf and gRPC .m & .h files (example) |
Objective-C | objc_proto_library | Generates an Objective-C protobuf library using objc_library (example) |
Objective-C | objc_grpc_library | Generates an Objective-C protobuf and gRPC library using objc_library (example) |
PHP | php_proto_compile | Generates PHP protobuf .php files (example) |
PHP | php_grpc_compile | Generates PHP protobuf and gRPC .php files (example) |
Python | python_proto_compile | Generates Python protobuf .py files (example) |
Python | python_grpc_compile | Generates Python protobuf and gRPC .py files (example) |
Python | python_grpclib_compile | Generates Python protobuf and grpclib .py files (supports Python 3 only) (example) |
Python | python_proto_library | Generates a Python protobuf library using py_library from rules_python (example) |
Python | python_grpc_library | Generates a Python protobuf and gRPC library using py_library from rules_python (example) |
Python | python_grpclib_library | Generates a Python protobuf and grpclib library using py_library from rules_python (supports Python 3 only) (example) |
Ruby | ruby_proto_compile | Generates Ruby protobuf .rb files (example) |
Ruby | ruby_grpc_compile | Generates Ruby protobuf and gRPC .rb files (example) |
Ruby | ruby_proto_library | Generates a Ruby protobuf library using ruby_library from rules_ruby (example) |
Ruby | ruby_grpc_library | Generates a Ruby protobuf and gRPC library using ruby_library from rules_ruby (example) |
Rust | rust_proto_compile | Generates Rust protobuf .rs files (example) |
Rust | rust_grpc_compile | Generates Rust protobuf and gRPC .rs files (example) |
Rust | rust_proto_library | Generates a Rust protobuf library using rust_library from rules_rust (example) |
Rust | rust_grpc_library | Generates a Rust protobuf and gRPC library using rust_library from rules_rust (example) |
Scala | scala_proto_compile | Generates a Scala protobuf .jar file (example) |
Scala | scala_grpc_compile | Generates Scala protobuf and gRPC .jar file (example) |
Scala | scala_proto_library | Generates a Scala protobuf library using scala_library from rules_scala (example) |
Scala | scala_grpc_library | Generates a Scala protobuf and gRPC library using scala_library from rules_scala (example) |
Swift | swift_proto_compile | Generates Swift protobuf .swift files (example) |
Swift | swift_grpc_compile | Generates Swift protobuf and gRPC .swift files (example) |
Swift | swift_proto_library | Generates a Swift protobuf library using swift_library from rules_swift (example) |
Swift | swift_grpc_library | Generates a Swift protobuf and gRPC library using swift_library from rules_swift (example) |
This project is derived from stackb/rules_proto under the Apache 2.0 license and this project therefore maintains the terms of that license