Open keith opened 3 months ago
seems like this case is actually more complicated, if i make it support visibility it fails with an args issue:
ERROR: /home/ubuntu/modular/utils/build/BUILD.bazel:14:19: //utils/build:generate_requirements_txt: no such attribute 'args' in 'alias' rule
ERROR: /home/ubuntu/modular/utils/build/BUILD.bazel:14:19: //utils/build:generate_requirements_txt: no such attribute 'data' in 'alias' rule
and it's also no longer runnable:
ERROR: Cannot run target //utils/build:generate_requirements_txt_with_cfg: Not executable
I don't see a clear solution to the visibility issues as it isn't possible to know whether a given rule or macro supports visibility
. I could add a knob for this if needed, but would prefer upstream just adding support for it - it's good hygiene for a macro to support it.
Regarding args
, I only recently added somewhat complex logic to handle locations in args
and it's pretty likely I messed something up. I'll investigate and push a fix.
I drafted https://github.com/fmeum/with_cfg.bzl/pull/108 based on your example and can't reproduce the args
issue, even if I remove executable = True
. What did you do to get it?
The remaining problems:
bazel run
command emitted into the generated file is the label of the untransitioned target. I don't see a way to fix this.*_diff_test
target is not forwarded as a test. It probably makes sense to extend the implicit_targets
parameter to cover this case.when I just added visibility
and not **kwargs
to that macro is when I hit the args issue, so with the patch upstream I imagine that sidesteps it
when I just added
visibility
and not**kwargs
to that macro is when I hit the args issue, so with the patch upstream I imagine that sidesteps it
Thanks, I sent https://github.com/fmeum/with_cfg.bzl/pull/110 to fix this part.
It seems like with_cfg assumes that all macros passed supports kwargs / manually visibility, but I found a case that doesn't with rules_uv:
https://github.com/theoremlp/rules_uv/blob/ce66cb575dd67072f8de70d02c46131bad55b994/uv/private/pip.bzl#L111-L119