You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Objects like cmd_args or RunInfo are formatted when dumped with ctx.output.write_json(). Is there a way to do the same thing with ctx.output.print_json()? If not, would this be accepted as a new feature, via an optional argument that defaults to False?
The text was updated successfully, but these errors were encountered:
I am not very sure what do you mean here. You mean you want the feature that the output of ctx.output.print_json() for objects like cmd_args or RunInfo be the same as actions.write_json?
Right now the output of ctx.output.print_json() for object cmd_args(["echo", "hello"]) is
I am not very sure what do you mean here. You mean you want the feature that the output of ctx.output.print_json() for objects like cmd_args or RunInfo be the same as actions.write_json?
Yes, I made a POC at main...cbarrete:buck2:print-json. I'm sure it wouldn't be merged as is because it just makes a lot of private APIs public for convenience, but the point is that it renders e.g. cmd_args as strings or lists of strings, artifacts as paths, etc.
I think that this behavior makes sense for most use cases? If someone is to output data as JSON, surely it is for something else to consume it, and the debug representation of starlark objects is unusable for those.
A concrete example is compilation database generation in C++: without this feature, one needs to write the JSON out to a file, print its path and have the user copy that file, as opposed to "just" redirecting stdout to the desired location.
Objects like
cmd_args
orRunInfo
are formatted when dumped withctx.output.write_json()
. Is there a way to do the same thing withctx.output.print_json()
? If not, would this be accepted as a new feature, via an optional argument that defaults toFalse
?The text was updated successfully, but these errors were encountered: