bazel-contrib / bazel-contrib/rules_foreign_cc

Support `per_file_copt`

Open
#1,332 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

Options passed as `--per_file_copt` are currently not honored by `rules_foreign_cc`.

This is blocking us from enabling `-Werror` for our own code but ignoring warnings on external code where we have no control over.
We want to do this with the following `.bazelrc`:
```
build --per_file_copt=external/.*@-Wno-everything --host_per_file_copt=external/.*@-Wno-everything
build --copt=-Werror --host_copt=-Werror
```

See https://github.com/bazelbuild/bazel/issues/24528 for further details.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how rules_foreign_cc assembles external build actions and whether the .bazelrc per_file_copt and host_per_file_copt options reach those actions. Use the provided -Wno-everything and -Werror configuration to reproduce the issue. Done means per-file compiler options are honored for external and host builds without weakening the global options.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.