#tonic-build #buf #protobuf #integrate #yaml #generate #proto

tonic-buf-build

A build helper that integrates buf.build to tonic-build

4 releases

0.2.0 Feb 16, 2024
0.1.2 Sep 21, 2023
0.1.1 Aug 16, 2023
0.1.0 Aug 16, 2023

#1804 in Encoding

Download history 18/week @ 2024-01-17 11/week @ 2024-02-07 190/week @ 2024-02-14 20/week @ 2024-02-21 30/week @ 2024-02-28 6/week @ 2024-03-06 18/week @ 2024-03-13 6/week @ 2024-03-27 15/week @ 2024-04-03 44/week @ 2024-04-10

65 downloads per month

MIT license

10KB
165 lines

tonic-buf-build

A build helper that allows you to integrate buf.build with tonic-build. Using buf.build and tonic, you can easily manage third party dependencies for proto files and generate code for your proto files in Rust. Works with both buf.yaml and buf.work.yaml.

Usage

Add the following to your Cargo.toml:

tonic-buf-build = "*"
tonic-build = "*"

Then, in your build.rs:

fn main() -> Result<(), tonic_buf_build::error::TonicBufBuildError> {
   tonic_buf_build::compile_from_buf(tonic_build::configure(), None)?;
   Ok(())
}

To use buf workspaces, simply call tonic_buf_build::compile_from_buf_workspace instead.

For complete and working examples, take a look at the examples folder.


lib.rs:

tonic-buf-build allows you to integrate buf.build with tonic-build. Using buf.build and tonic, you can easily manage third party dependencies for proto files and generate code for your proto files in Rust. Works with both buf.yaml and buf.work.yaml.

Usage

Add the following to your Cargo.toml:

tonic-buf-build = "*"
tonic-build = "*"

Then, in your build.rs:

fn main() -> Result<(), tonic_buf_build::error::TonicBufBuildError> {
   tonic_buf_build::compile_from_buf(tonic_build::configure(), None)?;
   Ok(())
}

To use buf workspaces, you simply call tonic-buf-build::compile_from_buf_workspace instead.

For complete and working examples, take a look at the examples folder.

Dependencies

~9–21MB
~290K SLoC