Open asa opened 10 months ago
Can you clarify
I am stuck with the flags the original author used
?
Do you mean --copt
or the copt
attribute on cc_*
or both?
i.e. if you're depending on the module, is the Bazel flag --copt
being set automatically somewhere?
I mean the original Copts flags on the cc_* rules.
Makes sense. What makes the --per_file_copt
approach too open?
We're exploring ideas of better containing which settings apply to which module. But I think the current thinking is to give modules more control over how they're built to build them more consistently. We'd have to be careful that overrides don't override intentional invariants the module authors want to enforce for their code.
Description of the feature request:
If I use a bzlmod module from the BCR, I am stuck with the flags the original author used, and their choices around warnings and error handling. In my teams we treat warnings as errors and use clang to compile c++, and so others choices around (often GCC) flags often need to be overriden when we use such packages. Currently I have been moving override flags into system wide locations in .bazelrc, which is too open. People on slack mentioned a pattern to have a
--per_file_copt
, which they apply to all external/.c files to disable warnings for instance. A better option would be to be able to override/filter any and all flags in an upstream bazel module, perhaps directly at definition. Others mentioned a--per_repo_copts
flag as a new feature that would take care of these needs. Another mentioned having a callback where we could have access to the flags in the upstream definition, and be able to do starlark things to that set of flags before it was applied in the local instantiation of the repo.Which category does this issue belong to?
Configurability
What underlying problem are you trying to solve with this feature?
Overriding upstream bazel module components to make selective changes before they are used in my bazel workspace.
Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?6.3.2