jq.bzlAPI docs @0.2.3

@jq.bzl//jq:jq.bzl

Public API for calling jq

Functions & Macros

jq

Invoke jq with a filter on a set of json input files.

Parameters
*name

Name of the rule

*srcs

List of input files. May be empty.

filter

Filter expression (https://stedolan.github.io/jq/manual/#Basicfilters).
Subject to stamp variable replacements, see Stamping.
When stamping is enabled, a variable named "STAMP" will be available in the filter.

Be careful to write the filter so that it handles unstamped builds, as in the example above.

Default: None
filter_file

File containing filter expression (alternative to filter)

Default: None
args

Additional args to pass to jq

Default: []
out

Name of the output json file; defaults to the rule name plus ".json"

Default: None
data

List of additional files. May be empty.

Default: []
expand_args

Run bazel's location and make variable expansion on the args.

Default: False
kwargs

Other common named parameters such as tags or visibility

Rules

jq_rule

Most users should use the jq macro instead.

AttributeTypeDescription
*namename

A unique name for this target.

*srcslist of labels
datalist of labels
Default: []
filterstring
Default: ""
filter_filelabel
Default: None
argslist of strings
Default: []
expand_argsboolean
Default: False
outlabel
Default: None
stampinteger

Whether to encode build information into the output. Possible values:

  • stamp = 1: Always stamp the build information into the output, even in
    --nostamp builds.
    This setting should be avoided, since it is non-deterministic.
    It potentially causes remote cache misses for the target and
    any downstream actions that depend on the result.
  • stamp = 0: Never stamp, instead replace build information by constant values.
    This gives good build result caching.
  • stamp = -1: Embedding of build information is controlled by the
    --[no]stamp flag.
    Stamped targets are not rebuilt unless their dependencies change.
Default: -1