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

Allow to specify --protocopt on per-target basis #230

Open
auzhva opened this issue Dec 15, 2024 · 0 comments
Open

Allow to specify --protocopt on per-target basis #230

auzhva opened this issue Dec 15, 2024 · 0 comments

Comments

@auzhva
Copy link

auzhva commented Dec 15, 2024

Problem Statement

In our project, we prefer to enable strict protobuf validations, with --fatal_warnings on for our targets.

Currently, we're not able to do so if any of the third-party libraries have protobuf files with warnings. So we're looking for some logic that would allow us to:

  1. Specify --fatal_warnings for our targets
  2. Leave it disabled for third-parties

Proposed Solution

If we take a look into how CC rules are implemented, there are 2 ways to supply CC options:

  1. --copt global flag that sets an option for everybody
  2. copts attribute of cc_library and cc_binary rules

For protoc, there is --protocopt which is sort of similar to --copt, but there is no way to specify options on a per-target basis. It would be great to see protocopts for the proto_library rule.

Something like:

proto_library(
    name = "sample_proto",
    srcs = ["sample.proto"],
    protocopts = ["--fatal_warnings"], # Here is the added part
    visibility = ["//visibility:public"],
)
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

No branches or pull requests

1 participant