fmeum / with_cfg.bzl

Apache License 2.0
34 stars 2 forks source link

`args` referencing `data` via location expansion is broken #82

Closed fmeum closed 1 month ago

fmeum commented 4 months ago

A transitioned executable rule such as:

sh_opt_binary(
    name = "foo",
    args = "$(rlocationpath :gen_data)",
    data = [":gen_data"],
)

fails with:

label ':gen_data' in $(location) expression is not a declared prerequisite of this rule. Since this rule was created by the macro 'lambda', the error might have been caused by the macro implementation
vonschultz commented 1 month ago

I have this problem too. Why does this happen? Is there any potential workaround?

fmeum commented 1 month ago

args is a special argument that is handled by native Bazel logic for all rules. It's thus pretty limited in how you can interact with it from Starlark. I'm thinking about how to solve this, but it's not clear to me yet whether this can be made to work without changes to Bazel itself.