Seemingly duplicate labels
See original GitHub issueDescription of the problem / feature request:
Basically it is good that Bazel forbids duplicate labels. But it should not make false-positives. For example:
cc_binary(
name = "hello",
srcs = select({ "//conditions:default" : [], "//:x86_32_windows" : ["sources/hello.cpp"] })
+ [ "sources/common.cpp" ]
+ select({ "//conditions:default" : [], "//:x64_windows" : ["sources/hello.cpp"] })
)
This target looks good, but in reality it won’t compile:
ERROR: C:/users/chebotarev_v/documents/src/bazel-issues/seemingly-duplicate-labels/BUILD:17:1: Label '//:sources/hello.cpp' is duplicated in the 'srcs' attribute of rule 'hello'
Feature requests: what underlying problem are you trying to solve with this feature?
Label lists can be combined with (+
) and come from different points of BUILD files, so these false-positives can be extremely hard to workaround in a project. I believe that should be fixed.
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Please find an example here: https://github.com/excitoon/bazel-issues/tree/master/seemingly-duplicate-labels
What operating system are you running Bazel on?
Windows 10 x64
What’s the output of bazel info release
?
Build label: 0.14.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Jun 1 13:06:29 2018 (1527858389)
Build timestamp: 1527858389
Build timestamp as int: 1527858389
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Avoiding Duplicate Labels When Including the Same Source ...
a duplicate of the original data is stored in a separate section of ... avoid it - since it involves a seemingly unavoidable...
Read more >Question - - Duplicate Labels on map | RedGuides: EverQuest Multi ...
If the duplicate names happen to be your group you can unclick show group in the EQ map. That way you will only...
Read more >I am getting unexpected duplicate labels when I print from ...
Bring up the record creating duplicates in Connexion client. Click F10 to open the Label printing settings. Correct the Copies of Each setting ......
Read more >Duplicate labels for single parts : r/QGIS - Reddit
It is trying to place labels at other scales, but seemingly with no rhyme or reason. EDIT: I even ran a "multi-part to...
Read more >How to Resolve Duplicate Data within Excel Pivot Tables
Excel 2003 and earlier: Drag these field names into the Row Labels and Data sections, respectively. You'll see in my case that account...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Consider using
collections.uniq
from https://github.com/bazelbuild/bazel-skylib to deduplicate thesrcs
of that target, e.g.:Add this to your
WORKSPACE
:And then use:
@gregestren Just came across the same issue after a bit of searching. I guess it would make sense to extend the docs with this information.
I created https://github.com/bazelbuild/bazel/pull/15714 to make this behavior easier to detect