bazel-contrib / rules_jsonnet

Jsonnet rules for Bazel
https://bazelbuild.github.io/rules_jsonnet/
Apache License 2.0
68 stars 73 forks source link

fix: restore default outputs of jsonnet_to_json #217

Closed thomasquinn closed 1 month ago

thomasquinn commented 1 month ago

This PR restores the default outputs of the jsonnet_to_json rule.

PR #192 seems to have broken the default outputs of this rule, which previously relied on only setting ctx.outputs and not returning a DefaultInfo provider (unless out_dir is set).

This is useful when you have some target that only has one output e.g.:

jsonnet_to_json(
    name = "foo",
    src = "foo.jsonnet",
    outs = ["foo.json"],
)

Before #192 you could depend on this as :foo, but after #192 you need to depend on :foo.json to access the singular output.

EdSchouten commented 1 month ago

Thanks! Could you please add a test case for this under examples/?

thomasquinn commented 1 month ago

Thanks! Could you please add a test case for this under examples/?

Let me know if there's a better way to test this than what I've come up with. This test does pass after the change to jsonnet/jsonnet.bzl and fail without it, at least.