You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works fine. But if you try to create your own rule that handles something similar, the ctx.expand_location API results in this error:
BUILD.bazel:23:15: in broken_genrule rule //:custom_broken_genrule: label '//:py_binary' in $(location) expression expands to more than one file, please use $(locations //:py_binary) instead. Files (at most 5 shown) are: [./py_binary.py, bazel-out/darwin_arm64-fastbuild/bin/py_binary]
Using the ctx.resolve_command API does seem to solve this, but it returns an array as the command, which might not be preferred, and requires post-processing any escaped $ signs.
I tried passing specific files to expand_location, but it seems to require a Target not any files, so it doesn't seem like something I can filter to only the inputs I care about.
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Work towards bazelbuild#11820Fixesbazelbuild#20038Fixesbazelbuild#23200Fixesbazelbuild#24613
RELNOTES: Extra targets provided to `ctx.expand_location` now expand to their executable (if any) instead of resulting in an error if they provide a number of files different from one.
RELNOTES[INC]: The `--incompatible_locations_prefers_executable` flag has been added and enabled, which makes it so that `ctx.expand_location` expands `$(locations :x)` to the executable of an extra target `:x` if it provides one and the number of files provided by it is not one.
Closesbazelbuild#24690.
PiperOrigin-RevId: 713453768
Change-Id: I0d6e052bc70deea029554ab722feb544f9597a23
(cherry picked from commit 457d248)
…24874)
Work towards #11820Fixes#20038Fixes#23200Fixes#24613
RELNOTES: Extra targets provided to `ctx.expand_location` now expand to
their executable (if any) instead of resulting in an error if they
provide a number of files different from one.
RELNOTES[INC]: The `--incompatible_locations_prefers_executable` flag
has been added and enabled, which makes it so that `ctx.expand_location`
expands `$(locations :x)` to the executable of an extra target `:x` if
it provides one and the number of files provided by it is not one.
Closes#24690.
PiperOrigin-RevId: 713453768
Change-Id: I0d6e052bc70deea029554ab722feb544f9597a23
(cherry picked from commit 457d248)
Fixes#24646
Description of the bug:
When you have a simple
py_binary
, that you use in agenrule
:This works fine. But if you try to create your own rule that handles something similar, the
ctx.expand_location
API results in this error:Using the
ctx.resolve_command
API does seem to solve this, but it returns an array as the command, which might not be preferred, and requires post-processing any escaped$
signs.I tried passing specific files to
expand_location
, but it seems to require aTarget
not any files, so it doesn't seem like something I can filter to only the inputs I care about.Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
bazel build :all
in repro.zipWhich operating system are you running Bazel on?
No response
What is the output of
bazel info release
?7.x
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 HEAD
?No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
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
The text was updated successfully, but these errors were encountered: