-
Notifications
You must be signed in to change notification settings - Fork 196
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
Is it possible to have a rule forward to another rule? #496
Comments
You can make a macro. def wrapped_cxx_library(srcs=[], **kwargs):
srcs.append("file.hh")
native.cxx_library(srcs = srcs, **kwargs) You don't need to return anything, rules don't return anything when you call them anyway (only the impl functions do). You can call multiple rules, and connect up the outputs of one to the inputs of the other, by constructing whatever = "{}-whatever".format(name)
native.cxx_library(name = whatever, ...)
native.cxx_library(..., deps = kwargs.pop("deps") + [":{}".format(whatever)], **kwargs) |
I'm using macros for this purpose right now, and it generally works ok but sometimes I wish I had access to some of the things in a rule impl's context structure. |
The |
Yea, unfortunately I can't do that unless I have access to the impl. So I can't do it, for example, if I want to forward to |
If I do this:
I get the following error:
I was experimenting with the idea of wrapping rules like
cxx_library()
to modify / change up the arguments before I pass them in. I feel like it gives me the ability to generate better error messages when the user does something wrong.My guess is you just can't do this, but figured it was worth asking about.
The text was updated successfully, but these errors were encountered: