Provide an option to opt-out of compile_well_known_types #3228
+37
−4
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.
This PR adds a
compile_well_known_types
flag to the Prost toolchain declaration.By default, for backwards compatibility reasons, this flag is set to
True
, as this is the current behavior. If this flag is switched toFalse
, thecompile_well_known_types
option is no longer passed to Prost and Tonic, and the protoc wrapper will ignore types from thegoogle.protobuf
package when computing external types, relying instead on prost's own externals handling. Furthermore, the configured Prost types crate will be added as a runtime dependency to allrust_prost_library
targets.We're currently migrating away from our own set of proto rules to
rust_prost_library
, but our existing code relies heavily on theprost-types
crate's implementations of well-known-types, which is the recommended way of using prost. However, the current behavior ofrules_rust_prost
makes it impossible to wire up properly, hence this PR.Fixes #2058