Skip to main content

aqueryctx type

The context for performing aquery operations in bxl. The functions offered on this ctx are the same behaviour as the query functions available within aquery command.

Query results are target_sets of action_query_nodes, which supports iteration, indexing, len(), set addition/subtraction, and equals().

aqueryctx.all_actions

def aqueryctx.all_actions(
targets: configured_target_label | label | providers_label | str | target_label | target_node | target_set | target_set | target_set | target_set | unconfigured_target_node | list[configured_target_label | label | providers_label | str | target_label | target_node | unconfigured_target_node]
) -> target_set

Obtain all the actions declared within the analysis of a given target.

This operation only makes sense on a target literal (it is a simple passthrough when passed an action).


aqueryctx.all_outputs

def aqueryctx.all_outputs(
targets: configured_target_label | label | providers_label | str | target_label | target_node | target_set | target_set | target_set | target_set | unconfigured_target_node | list[configured_target_label | label | providers_label | str | target_label | target_node | unconfigured_target_node]
) -> target_set

Obtain the actions for all the outputs provided by the DefaultInfo for the targets passed as input. This includes both the default_outputs and other_outputs.

This operation only makes sense on a target literal (it does nothing if passed something else).


aqueryctx.attrfilter

def aqueryctx.attrfilter(
attr: str,
value: str,
targets: configured_target_label | label | providers_label | str | target_label | target_node | target_set | target_set | target_set | target_set | unconfigured_target_node | list[configured_target_label | label | providers_label | str | target_label | target_node | unconfigured_target_node]
) -> target_set

The attrfilter query for rule attribute filtering.


aqueryctx.deps

def aqueryctx.deps(
universe: configured_target_label | label | providers_label | str | target_label | target_node | target_set | target_set | target_set | target_set | unconfigured_target_node | list[configured_target_label | label | providers_label | str | target_label | target_node | unconfigured_target_node],
depth: None | int = None,
filter: None | str = None
) -> target_set

The deps query for finding the transitive closure of dependencies.


aqueryctx.eval

def aqueryctx.eval(query: str, query_args: None | target_set | list[str] = None)

Evaluates some general query string. query_args can be a target_set of unconfigured nodes, or a list of strings. Returns a dict of target labels mapped to their target_set results if query_args was passed in, otherwise returns a single target_set.

Sample usage:

def _impl_eval(ctx):
result = ctx.aquery().eval(":foo")
ctx.output.print(result)