bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.99k stars 4.03k forks source link

cc_library defines should reject dict argument #17553

Open eustas opened 1 year ago

eustas commented 1 year ago

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

buildbreaker2021 commented 1 year ago

Did you mean: defines = {'KKKEEEYY' : 'VALUE'}? : instead of ,

eustas commented 1 year ago

Right. Fixed description.

buildbreaker2021 commented 1 year ago

This is interesting, I assume it is not just defines attribute for cc_library that is affected but all string_list attributes on Starlark rules might have similar problem, will investigate further.

github-actions[bot] commented 4 months ago

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

fmeum commented 4 months ago

@bazelbuild/triage not stale