Say I have a rule like this, defined in a package //rules
:
myrule = rule(
implementation = _impl,
attrs = {
"label": attr.label(default = ":default.txt", mandatory = True),
},
)
Then I call it from another package, //caller
, like this:
myrule(name = "mytarget")
Bazel will complain that /package/default.txt
does not exist, but I want it to use /caller/default.txt
. I can accomplish this using a macro instead:
def mymacro(label = ":default.txt", **kwargs):
myrule(label = label, **kwargs)
But is there a way I can accomplish it without the macro, by writing the default value in a different way?