-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add and flip --incompatible_locations_prefers_executable
#24690
Conversation
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.
8667744
to
755b7d3
Compare
@brandjon Yun and I agreed that a minor incompatible change would be acceptable even for 8.0.1. Based on that, I personally find this to be the less surprising (and simpler) solution to the linked issues (most importantly the regression #24613) than the fully backwards compatible change that only modifies the behavior of An alternative could be to always prefer the executable, even over a single file, as is the case for location expansion on the hardcoded list of attributes. I could see this being much more breaking, e.g. thinking of a WASM binary that sets its executable to an interpreter that runs the actual artifact. Your opinion and ideas would be very welcome! |
Delegating to @comius as this is more analysis-time rule logic than loading phase stuff. |
@comius do you think it's a good idea to get this in soon (within the week)? If not, we should take this off the 8.0.1 blocker list. |
Work towards bazelbuild#11820 Fixes bazelbuild#20038 Fixes bazelbuild#23200 Fixes bazelbuild#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 bazelbuild#24690. PiperOrigin-RevId: 713453768 Change-Id: I0d6e052bc70deea029554ab722feb544f9597a23 (cherry picked from commit 457d248)
…24874) Work towards #11820 Fixes #20038 Fixes #23200 Fixes #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
Thank you @fmeum for the patch, i really wanted to contribute this myself but you beat me to it :) |
Work towards #11820
Fixes #20038
Fixes #23200
Fixes #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 thatctx.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.