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
It should be possible to consume multiple default_outputs
in an attrs.list(attrs.source())
#561
Comments
Let me quote some of my comment here:
It's possible that someone on the team has stronger opinions on this then I do, but at least for me, this case is an example of it not being entirely clear what we should do. |
Thanks for the context. If you were to add a function like
But with the suggested change, I could change bit to this:
which is a huge improvement not just in that line of code, but in the implementation of the rule itself, since I wouldn't even have to create any subtargets. Even beyond this use case though, just being able to access the |
So one of the difficulties with this kind of The best thing that I can think of right now is that maybe we should just try and make multiple default outputs on a single item in an |
I trust you when you say the ergonomics of the proxy object would be grim, but it helps me understand what's going on under the hood, so apologies if I keep digging :) Are you talking about ergonomics from the user side, from the buck2 core runtime side, from the rule implementation side, or something else? I'm imaging that if you did do the proxy object, then all of the complexity of reaching into this proxy object could be silently handled by Does this not work? |
I'm more worried about the macro side, not the rule side. You still need to make this compose with other things that people do in macros. For example, someone is going to write Something like this exists already for another function widely used in macros: |
I have a genrule that outputs multiple files by returning a
DefaultInfo()
whosedefault_outputs
is set to a list with more than 1 item, it would be really nice if I could have these consumed by another rule as follows:If you look at this documentation, it even explicitly states that it should work, because of this line:
I understand that it might be difficult to get the type checking to pass here, since technically the target label
:gen_stuff
is one thing, and expanding it would really expand to a list, at which point you have a list of lists. But I think if you introduced a global function calleddefault_outputs
, this would be very elegant. Then you'd write my original example as:Just like glob returns a list, this too could return a list.
What are the chances of seeing something like this implemented?
The text was updated successfully, but these errors were encountered: