facebook / buck2

Build system, successor to Buck
https://buck2.build/
Apache License 2.0
3.38k stars 200 forks source link

--show-output (and related options show nothing in column 2) when using DefaultInfo with default_outs #543

Open nathanaelhuffman opened 5 months ago

nathanaelhuffman commented 5 months ago

I'll caveat this with the comment that I'm very new to playing with buck2, so it's possible I'm doing something wrong or have incorrect expectations.

While building some .bzl files to support a build flow I noticed that if I have rule returning a DefaultInfo(default_outs=<someList>) the --show-output command when doing buck2 build shows nothing in the 2nd column of the output, whereas I think it should show the outputs list? This is true for the other show output commands as well (full, json etc) ie none of these show the output information either.

If i change the return to do DefaultInfo(default_out=<someList>[0]) ie just picking the first element in the list, the --show-output command shows the expected info in the 2nd output column.

Is it expected that nothing is shown when DefaultInfo uses default_outs?

JakobDegen commented 4 months ago

This particular example is, I think, just a bug.

But more generally, I don't think we always know. The possibility of having multiple outputs was added to buck2 because we thought it was generally a good idea. However, based on something I heard from @cjhopman , we never really used it internally because it turned out that too much stuff broke if --show-output returned more than one output. Instead, we've mostly gone with subtargets to make any additional outputs available.

The result of that is that the "multiple outputs" support is only partially complete, and I don't think we ever fully figured out what we want from it. If you want to stay on the well-trodden path, not using it would probably be your best bet. On the other hand, the fact that this isn't really figured out yet also means that we'd be happy to take PRs that build this support out and clarify how things should work