bazel icon indicating copy to clipboard operation
bazel copied to clipboard

cc_library defines should reject dict argument

Open eustas opened this issue 2 years ago • 5 comments

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

eustas avatar Feb 22 '23 13:02 eustas

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

buildbreaker2021 avatar Mar 06 '23 10:03 buildbreaker2021

Right. Fixed description.

eustas avatar Mar 06 '23 10:03 eustas

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.

buildbreaker2021 avatar Mar 06 '23 10:03 buildbreaker2021

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.

github-actions[bot] avatar May 10 '24 01:05 github-actions[bot]

@bazelbuild/triage not stale

fmeum avatar May 10 '24 07:05 fmeum