bazel-contrib / bazel-contrib/rules_foreign_cc
RFC: Add support for `CPPFLAGS` and clean up `CxxFlagsInfo`
- Dominant language
- Starlark
- Stars
- 737
- Forks
- 270
- PR merge metrics
- No merged PRs in 30d
Description
While working on #1230, it came to my attention that if `CPPFLAGS` is included in the `env` of a `configure_make` rule, they are also ignored. I think this should be supported like the other `xxxFLAGS` variables and would like to get feedback on a PR that touches the code as follows:
1. Add `CPPFLAGS` to `_MAKE_FLAGS`:
https://github.com/bazelbuild/rules_foreign_cc/blob/9d5727d5e51bf1be8423dff7996bdb4d847b47e6/foreign_cc/private/make_env_vars.bzl#L79-L88
2. Add `cpp` to `CxxFlagsInfo` provider struct:
https://github.com/bazelbuild/rules_foreign_cc/blob/9d5727d5e51bf1be8423dff7996bdb4d847b47e6/foreign_cc/private/cc_toolchain_util.bzl#L28-L38
I would also like to clean up the names of the variables inside `CxxFlagsInfo` since they are quite misleading and inconsistent. Linked flags are language in dependent. Would the following be acceptable? I think this provider is just used internally so it would not be a breaking change, right?
```starlark
CFlagsInfo = provider(
doc = "Flags for the C/C++ tools, taken from the toolchain",
fields = dict(
c = "C compiler flags",
cxx = "C++ compiler flags",
cpp = "C/C++ preprocessor flags",
linker_shared = "Linker flags when linking shared library",
linker_static = "Linker flags when linking static library",
linker_executable = "Linker flags when linking executable",
asm = "Assembler flags",
),
)
```
Contributor guide
Research direction
Start with the linked sections of foreign_cc/private/make_env_vars.bzl and foreign_cc/private/cc_toolchain_util.bzl, then inspect references to CxxFlagsInfo. Done means CPPFLAGS is included with the other make flags and the provider fields use the proposed names, subject to maintainer feedback on the RFC.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100