Commit generated protobuf code, only regenerate on-demand #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #41
Since v0.11 (4fea65b),
prost-build
requiresprotoc
to be installed while compiling. This means any downstream application / library of bitar also needs it to compile.This PR adds the generated code directly the repository, and only regenerates it on-demand.
Deciding when to regenerate the code is a bit of a pain - you can't use
cargo:rerun-if-changed
, since that will run directly after a clean check-out, and thus fail withoutprotoc
. The best compromise between elegance and practicality i found was to only regenerate when the generated file has been removed. I've added some comments to clarify this; since the file is rarely changed it shouldn't be too much of a hassle.Alternative solutions to consider:
rerun-if-changed
and check ifprotoc
is in PATH. This "silent switch" could lead to build inconsistencies downstream, where the buildscript also runs..rs
file, compile the protobuf files to a.bin
usingprotoc
and commit that. The buildscript would work as before (sourcing from the.bin
instead of.proto3
), without needingprotoc
. See for instance feat: vendor pbjson-types descriptor set (#62) influxdata/pbjson#79protoc
with this crate, despite the security concerns raised in Remove build.rs tokio-rs/prost#657. Seeprotoc-prebuilt
,protoc_bin_vendored
,protoc_fetcher