bazelbuild / bazelbuild/bazel

Bazel should warn if a target depends on `features` that aren't defined.

Open
#4,030 6 comments 0 reactions 0 assignees View on GitHub
not stale P4 team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

Given a BUILD file with a target using the `features` attr:

```python
cc_binary(
name = "hello",
srcs = ["hello.cc"],
features = ["no-such-feature"],
)
```

When building this, I would expect Bazel to print some warning about `no-such-feature` being undefined. Currently (as of release 0.7.0) no such warning is printed, which makes it difficult to notice that a typo has prevented some desired feature from being applied.

Contributor guide

Open the contributing guide

Research direction

Start with the BUILD example and trace how Bazel handles the `features` attribute for `cc_binary` targets. Add coverage for an undefined feature and verify that building the example emits a warning identifying `no-such-feature`.

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.