bazelbuild / bazelbuild/bazel

Document `feature` API

Open
#16,238 0 comments 1 reaction 0 assignees View on GitHub
help wanted P3 team-Documentation team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

I was trying to compile a project with sanitizers enabled when I ran into an issue with a dependency. I figured that I'll disable the sanitizer for that dependency and move on. Based on [this SO thread](https://stackoverflow.com/questions/63588902/in-bazel-how-to-prevent-some-c-compiler-flags-from-passing-to-external-depend), it seemed like `feature` would be ideal for disabling sanitizers on a per-object basis.
Now I just wanted to see the API specification for `feature` so that I can use it properly. But, it doesn't exist.
Features are talked about [here](https://bazel.build/docs/cc-toolchain-config-reference#features), but that's about it. I can't find anywhere in the docs where the parameters `feature` takes are listed or described. This is it (as far as I can see).

Could `feature` get some love in the docs please? I presume that it's still supported because of the multitude of rules which have a features list as a parameter.

Apologies if I've submitted this in the incorrect category or messed up the admin of this issue - I wasn't sure how a docs request fits in.

### What underlying problem are you trying to solve with this feature?

Understanding the `feature` API.

### Which operating system are you running Bazel on?

N/A

### What is the output of `bazel info release`?

N/A

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

N/A

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

```text
N/A
```

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the cc-toolchain-config-reference page linked in the issue and identify the existing coverage of features. Document the feature API parameters and their usage so users can understand how to configure features, including the per-object sanitizer use case described here.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 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.