bazel-skylib icon indicating copy to clipboard operation
bazel-skylib copied to clipboard

run_binary rule should support $(execpath ...) etc.

Open phst opened this issue 2 years ago • 5 comments

Right now run_binary only supports $(location …), cf. https://github.com/bazelbuild/bazel-skylib/blob/5bfcb1a684550626ce138fe0fe8f5f702b3764c3/rules/run_binary.bzl#L37. It should also support $(execpath …) and possible (if it makes sense) $(rootpath …) and $(rlocationpath …). (Same with the pluralized forms, of course.)

phst avatar Jan 18 '23 11:01 phst

I've run into the same, workaround is crude - either use env/args or defines in my cc_binary tool to get the rlocationpath and the tool is no longer generic (e.g. it's tied to specific file). As if run_binary needs support for data (maybe)?

malkia avatar Feb 19 '23 06:02 malkia

Also just ran into this myself.

aaronemassey avatar Mar 24 '23 21:03 aaronemassey

AFAICT, we could simply call ctx.expand_location unconditionally, and get support for all the location callbacks it supports (the ones listed in https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/analysis/LocationExpander.java#L383)

tetromino avatar Jul 05 '23 20:07 tetromino