Skip to content

Commit

Permalink
Pin the dependencies of the Rust code gen tools
Browse files Browse the repository at this point in the history
In the previous commit, only the version of `protoc-gen-prost/tonic` was
pinned. However, Cargo would still ignore the lock file and use the
latest version of dependencies for `protoc-gen-prost/tonic`. This meant
that any new release of dependencies (such as `prost-build`) could
result in differences in the generated code.

This commit addresses the issue by adding `--locked` to the `cargo
install` command, ensuring Cargo respects the lock file when installing
code generation tools.

The Rust code has been regenerated using this updated configuration.
  • Loading branch information
duskmoon314 committed Sep 24, 2024
1 parent f304ae3 commit 3be9e37
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 56 deletions.
2 changes: 1 addition & 1 deletion codegen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.81.0 --profile minimal; \
. $HOME/.cargo/env; \
cargo install protoc-gen-prost@0.4.0 protoc-gen-prost-crate@0.4.1 protoc-gen-tonic@0.4.1
cargo install --locked protoc-gen-prost@0.4.0 protoc-gen-prost-crate@0.4.1 protoc-gen-tonic@0.4.1

ENV PATH="${PATH}:/root/.cargo/bin"

Expand Down
1 change: 1 addition & 0 deletions rust/src/google.rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
///
/// You can find out more about this error model and how to work with it in the
/// [API Design Guide](<https://cloud.google.com/apis/design/errors>).
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Status {
/// The status code, which should be an enum value of
Expand Down
Loading

0 comments on commit 3be9e37

Please sign in to comment.