Open
Description
Feature Request
Crates
tonic_build
Motivation
We run tonic_build
manually and check in our generated code.
We want to have a CI step to check that the generated code is up-to-date.
Proposal
Add an option to Builder
that, when set, will cause the compile_protos
invocation to FAIL if the files on disk differs from the generated ones.
The fail could be returning a special error.
let is_on_ci: bool = …;
tonic_build::configure()
.out_dir(output_dir.as_ref())
.build_client(true)
.build_server(true)
.fail_on_diff(is_on_ci) // Turn on "check" mode when we're on CI
.compile_protos(proto_paths, &[definitions_dir])
.unwrap(); // will fail if the files require changes on ci
Alternatives
As a user, I can also just run the code-gen and then check for diffs with git
- but that is messy.
Metadata
Metadata
Assignees
Labels
No labels