Awesome Open Source
Awesome Open Source

Protobuf and gRPC rules for Bazel

Bazel rules for building Protobuf and gRPC code and libraries from proto_library targets

Announcements 📣

2021/09/22 - Version 4.0.0

Version 4.0.0 has been released with updated dependencies and removal of some previously deprecated features. gRPC has been updated to 1.40.0 and Protobuf has been updated to 3.18.0. This update will be a drop-in upgrade with no changes needed for most users, however there are a couple of breaking changes in the Javascript and Rust rules. Please see the release notes linked above for all changes or check the language specific rules pages in the docs. 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.

2021/03/03 - Version 3.1.0

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.

Usage

Full documentation for the current and previous versions can be found here

Rules

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)
Documentation doc_template_compile Generates documentation file using Go template file (example)
F# fsharp_proto_compile Generates F# protobuf .fs files (example)
F# fsharp_grpc_compile Generates F# protobuf and gRPC .fs files (example)
F# fsharp_proto_library Generates a F# protobuf library using fsharp_library from rules_dotnet. Note that the library name must end in .dll (example)
F# fsharp_grpc_library Generates a F# protobuf and gRPC library using fsharp_library from rules_dotnet. Note that the library name must end in .dll (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_validate_compile Generates Go protobuf and gRPC validation .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)
Go go_validate_library Generates a Go protobuf and gRPC validation 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)

License

This project is derived from stackb/rules_proto under the Apache 2.0 license and this project therefore maintains the terms of that license


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Grpc (2,224
Protobuf (1,268
Build Tool (1,020
Protocol Buffers (688
Starlark (441
Bazel (419
Related Projects