Open illicitonion opened 1 year ago
cc @fmeum - sorry for not testing that PR thoroughly enough before...
I think that this is a quirk in the Python rules rather than in the implementation of --output=files
:
$ bazel cquery --output=starlark :pyb '--starlark:expr=providers(target)["FileProvider"].files_to_build' 2>/dev/null
depset([<source file pyb.py>, <generated file pyb>])
https://github.com/bazelbuild/bazel/blob/daa3dbe22adb03338c75b53ea97954c9434099b4/src/main/starlark/builtins_bzl/common/python/py_executable.bzl#L195-L197 seems related. @rickeylev, can you say more about this?
Yeah, it's a undesirable quirk. It's been there a long time. I was never able to track down when it came about or why; my best guess is it is some holdover from a much earlier phase in Bazel's life when what a rule produced wasn't as well defined or controllable.
Description of the bug:
For this BUILD file:
This query produces both the source file and the output file:
In this case, it feels like just the generated file should be output, not the source file?
(This was the behaviour in Bazel 5, and I'm aware it was changed at my request in https://github.com/bazelbuild/bazel/pull/16602)
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Expect that last command to instead act like this:
Which operating system are you running Bazel on?
macOS
What is the output of
bazel info release
?release 6.1.0
If
bazel info release
returnsdevelopment 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