bazel: suppress protobuf deprecation warnings in generated .pb.cc files#29945
Conversation
Existing suppressions covered external protobuf sources and specific redpanda .cc files that include protobuf headers, but missed generated .pb.cc files (e.g. under proto/ or src/v/schema/protobuf/).
There was a problem hiding this comment.
Pull request overview
Updates Bazel build flags to suppress protobuf deprecation warnings across all generated protobuf C++ sources, so new proto targets don’t require per-target or per-file additions.
Changes:
- Add a
--per_file_coptwildcard rule intended to match all generated*.pb.ccfiles and disable-Wdeprecated-declarationsfor them.
| build --per_file_copt=src/v/serde/protobuf/tests/parser_test.cc@-Wno-deprecated-declarations | ||
| build --per_file_copt=src/v/iceberg/conversion/tests/iceberg_protobuf_tests.cc@-Wno-deprecated-declarations | ||
| build --per_file_copt=src/v/pandaproxy/schema_registry/protobuf.cc@-Wno-deprecated-declarations | ||
| build --per_file_copt=.*\\.pb\\.cc@-Wno-deprecated-declarations |
There was a problem hiding this comment.
The --per_file_copt pattern is over-escaped in .bazelrc. In a .bazelrc file there is no shell layer, so .*\\.pb\\.cc is passed literally and the regex will not match *.pb.cc as intended (it effectively matches a backslash followed by any character). Use a single backslash for escaping the dots (and consider anchoring with $ if you want to avoid partial matches).
| build --per_file_copt=.*\\.pb\\.cc@-Wno-deprecated-declarations | |
| build --per_file_copt=.*\.pb\.cc$@-Wno-deprecated-declarations |
There was a problem hiding this comment.
Empirically it works?
There was a problem hiding this comment.
I really dislike this UX fwiw I always run into escaping problems.
|
/ci-repeat 1 |
|
BK seems to have gotten confused by two PRs I opened close in time, one from my own repo and one from rp (which I closed). |
| build --per_file_copt=src/v/serde/protobuf/tests/parser_test.cc@-Wno-deprecated-declarations | ||
| build --per_file_copt=src/v/iceberg/conversion/tests/iceberg_protobuf_tests.cc@-Wno-deprecated-declarations | ||
| build --per_file_copt=src/v/pandaproxy/schema_registry/protobuf.cc@-Wno-deprecated-declarations | ||
| build --per_file_copt=.*\\.pb\\.cc@-Wno-deprecated-declarations |
There was a problem hiding this comment.
I really dislike this UX fwiw I always run into escaping problems.
CI test resultstest results on build#82279
|
Existing per-file suppressions covered the external protobuf sources and
specific redpanda
.ccfiles that include protobuf headers, but missedgenerated
.pb.ccfiles (e.g. underproto/orsrc/v/schema/protobuf/).This adds a wildcard
per_file_coptrule for all*.pb.ccfiles so newproto targets don't need individual entries.
Backports Required
Release Notes