# Jsonnet Rules ## Rules * [`jsonnet_library`](#jsonnet_library) * [`jsonnet_to_json`](#jsonnet_to_json) * [`jsonnet_to_json_test`](#jsonnet_to_json_test) ## Overview These are build rules for working with [Jsonnet][jsonnet] files with Bazel. [jsonnet]: http://google.github.io/jsonnet/doc/ ## Setup To use the Jsonnet rules, simply copy the contents of `jsonnet.WORKSPACE` into your `WORKSPACE` file. ## jsonnet_library ```python jsonnet_library(name, srcs, deps, imports) ```
Attribute | Description |
---|---|
name |
Name, required
A unique name for this rule. |
srcs |
List of Labels, required
List of |
deps |
List of labels, optional
List of targets that are required by the |
imports |
List of strings, optional
List of import |
Attribute | Description |
---|---|
name |
Name, required
A unique name for this rule. This name will be used as the name of the JSON file generated by this rule. |
src |
Label, required
The |
deps |
List of labels, optional
List of targets that are required by the |
outs |
List of Filenames, optional
Names of the output .json files to be generated by this rule. If you are generating only a single JSON file and are not using jsonnet multiple output files, then this attribute should only contain the file name of the JSON file you are generating.
If you are generating multiple JSON files using jsonnet multiple file
output (
For the case where multiple file output is used but only for
generating one output file, set the |
multiple_outputs |
bool, optional, default 0
Set to 1 to explicitly enable multiple file output via the
This is used for the case where multiple file output is used but only for generating a single output file. For example: local foo = import "foo.jsonnet"; { "foo.json": foo, } |
imports |
List of strings, optional
List of import |
vars |
String dict, optional
Map of variables to pass to jsonnet via |
code_vars |
String dict, optional
Map of code variables to pass to jsonnet via
|
Attribute | Description |
---|---|
name |
Name, required
A unique name for this rule. This name will be used as the name of the JSON file generated by this rule. |
src |
Label, required
The |
deps |
List of labels, optional
List of targets that are required by the |
imports |
List of strings, optional
List of import |
vars |
String dict, optional
Map of variables to pass to jsonnet via |
code_vars |
String dict, optional
Map of code variables to pass to jsonnet via
|
golden |
Label, optional
The expected (combined stdout and stderr) output to compare to the
output of running |
error |
Integer, optional, default is 0
The expected error code from running |
regex |
bool, optional, default is False
Set to 1 if |