rules_runfiles_groupAPI docs @0.0.1-rc.4

@rules_runfiles_group//runfiles_group:lib.bzl

Public API for runfiles group library functions.

Functions & Macros

lib.collect_groups
Parameters
*deps
strip_executable_group
Default: True
lib.group_metadata

Creates a validated group metadata struct.

Parameters
rank

Partial ordering key. Lower rank = earlier. Default 0.

Default: 0
do_not_merge

If True, packager must not merge this group. Default False.

Default: False
weight

Merge priority hint (int >= 0 or None). Default None.

Default: None
executable_group

If True, the packager should place the executable
and supporting files into this group. Default False.

Default: False
lib.group_names

Returns the list of group names in a RunfilesGroupInfo instance.

Parameters
*runfiles_group_info
lib.merge_metadata
Parameters
metadatas
lib.merge_to_limit
Parameters
*runfiles_group_info
runfiles_group_metadata_info
Default: None
*max_groups
default_weight
Default: 0
merged_group_name
Default: None
lib.ordered_groups
Parameters
*runfiles_group_info
runfiles_group_metadata_info
Default: None
lib.transform_groups
Parameters
*runfiles_group_info
runfiles_group_metadata_info
Default: None
runfiles_transform_info
Default: None

@rules_runfiles_group//runfiles_group:providers.bzl

Public API for runfiles group providers.

Providers

RunfilesGroupInfo

Information about grouped runfiles.

Each field in this provider is a depset of File objects, representing a category of runfiles.
Merging all depsets from all fields must yield the same set of files as DefaultInfo.default_runfiles.

This provider functions similarly to OutputGroupInfo, but its presence in the output of a rule indicates that it can be used instead of DefaultInfo.default_runfiles.
It categorizes the runfiles of a target into different groups, allowing for more fine-grained control over which runfiles are used in different contexts.

RunfilesGroupMetadataInfo

Metadata about groups in a RunfilesGroupInfo instance.

Each entry maps a group name to a struct with:

  • rank (int): Partial ordering key. Lower rank = earlier. Default 0.
  • do_not_merge (bool): If True, packager must not merge this group. Default False.
  • weight (int or None): Hint for merge priority. Lighter groups merge first.
    If None, the packager may apply an undefined default. Default None.
  • executable_group (bool): If True, signals that the packager should place
    the executable file, runfiles symlinks, repo mapping manifest, and other
    supporting files for the main entrypoint into this group. Default False.

Groups not present in the dict are treated as having default metadata
(rank=0, do_not_merge=False, weight=None, executable_group=False).

Fields
groups

A dict mapping group name (string) to a struct with rank, do_not_merge, weight, and executable_group fields.
Groups not present get default metadata (rank=0, do_not_merge=False, weight=None, executable_group=False).

RunfilesGroupTransformInfo

Information about how to transform a RunfilesGroupInfo (and its metadata).

The transform function receives (RunfilesGroupInfo, RunfilesGroupMetadataInfo_or_None)
and must return a struct with two fields:

  • runfiles_group_info: the transformed RunfilesGroupInfo
  • runfiles_group_metadata_info: the transformed RunfilesGroupMetadataInfo (or None)
Fields
transform

A starlark function (RunfilesGroupInfo, RunfilesGroupMetadataInfo_or_None) ->
struct(runfiles_group_info, runfiles_group_metadata_info).

@rules_runfiles_group//runfiles_group:runfiles_group_analysis_test.bzl

Public API for runfiles_group_analysis_test.

Rules

runfiles_group_analysis_test

Checks that RunfilesGroupInfo is well formed by comparing the runfiles of the executable (DefaultInfo.default_runfiles.files)
with the union of all runfiles from RunfilesGroupInfo.

Additionally, it can warn about files appearing in multiple groups (overlapping),
verify the expected ordered group names after applying the full resolution protocol,
and optionally apply merge-to-limit before ordering.

AttributeTypeDescription
*namename

A unique name for this target.

*binarieslist of labels

List of *_binary targets to test.

overlapping_group_behaviorstring

How to handle overlapping groups (the same file being present in more than one group).

Default: "warn"
expected_group_nameslist of strings

If set, the test verifies that the ordered group names (after optional merging and rank-based ordering)
match this list exactly. Applies to all binaries in the test.

Default: []
max_groupsinteger

If >= 0, apply lib.merge_to_limit with this limit before ordering. -1 means no limit.

Default: -1
expected_group_countinteger

If >= 0, verify the exact number of groups after merging (requires max_groups >= 0).
Use this when merging cannot reach max_groups (e.g., due to do_not_merge or rank constraints)
to assert the actual reachable count. -1 means no check (the test fails if group_count > max_groups instead).

Default: -1