cc_library defines should reject dict argument
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Description of the bug:
Currently if `defines` value is `dict`, then compilation result is somewhat unexpected.
Bazel should report that `list` argument type is expected (as stated in docs).
It it likely that argument is used as array-like and `dict` keys are transformed to compiler options.
Alternative: allow `dict` argument, but transform entires to `-Dkey=value`
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
1) Add to some cc_library: `defines = {'KKKEEEYY': 'VALUE'}`
2) Search `bazel build -c` output for `KKKEEEYYY`.
### Which operating system are you running Bazel on?
_No response_
### What is the output of `bazel info release`?
release 6.0.0
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?
_No response_
### 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
Research direction
Reproduce the issue with a minimal cc_library using defines = {'KKKEEEYY': 'VALUE'} and inspect how the defines argument is validated and converted into compiler options. Done means a dict is rejected with an error stating that a list is expected, or the chosen documented behavior is implemented and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100