/rules_proto_grpc

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

Primary LanguageStarlarkApache License 2.0Apache-2.0

Protobuf and gRPC rules for Bazel

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

Announcements 📣

2023/09/12 - Version 4.5.0

Version 4.5.0 has been released, which contains a number of version updates, bug fixes and usability improvements over 4.4.0. Additionally, the Rust rules contain a major change of underlying gRPC and Protobuf library; the rules now use Tonic and Prost respectively

2023/05/03 - Version 4.4.0

Version 4.4.0 has been released, which mainly contains fixes for build edge-cases and wider compatibility

2022/12/04 - Version 4.3.0

Version 4.3.0 has been released, which contains support for more plugins features, fixes for proto paths containing special characters and updates to the core dependencies

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_prost_proto_compile Generates Rust protobuf .rs files using prost (example)
Rust rust_tonic_grpc_compile Generates Rust protobuf and gRPC .rs files using prost and tonic (example)
Rust rust_prost_proto_library Generates a Rust prost protobuf library using rust_library from rules_rust (example)
Rust rust_tonic_grpc_library Generates a Rust prost protobuf and tonic 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