Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an option to opt-out of compile_well_known_types #3228

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexkirsz
Copy link
Contributor

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 to False, the compile_well_known_types option is no longer passed to Prost and Tonic, and the protoc wrapper will ignore types from the google.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 all rust_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 the prost-types crate's implementations of well-known-types, which is the recommended way of using prost. However, the current behavior of rules_rust_prost makes it impossible to wire up properly, hence this PR.

Fixes #2058

@alexkirsz alexkirsz force-pushed the alexkirsz/compile-well-known-types branch 2 times, most recently from 30baa83 to 9247136 Compare January 31, 2025 14:06
@alexkirsz alexkirsz force-pushed the alexkirsz/compile-well-known-types branch from 9247136 to 0f2ba75 Compare January 31, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What's a good default for protoc-gen-{prost|tonic}'s compile_well_known_types?
1 participant