@rules_runfiles_group//runfiles_group:lib.bzl
Public API for runfiles group library functions.
Functions & Macros
lib.group_metadataCreates 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 |
lib.group_namesReturns the list of group names in a RunfilesGroupInfo instance.
Parameters
*runfiles_group_info |
lib.merge_metadataParameters
*base | |
*override |
lib.merge_to_limitParameters
*runfiles_group_info | |
runfiles_group_metadata_info | Default: None |
*max_groups | |
default_weight | Default: 0 |
merged_group_name | Default: None |
lib.ordered_groupsParameters
*runfiles_group_info | |
runfiles_group_metadata_info | Default: None |
lib.transform_groupsParameters
*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
RunfilesGroupInfoInformation 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.
RunfilesGroupMetadataInfoMetadata 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.
Groups not present in the dict are treated as having default metadata
(rank=0, do_not_merge=False, weight=None).
Fields
groups | A dict mapping group name (string) to a struct with rank, do_not_merge, and weight fields. |
RunfilesGroupTransformInfoInformation 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) -> |
@rules_runfiles_group//runfiles_group:runfiles_group_analysis_test.bzl
Public API for runfiles_group_analysis_test.
Rules
runfiles_group_analysis_testChecks 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.
| Attribute | Type | Description |
|---|---|---|
*name | name | A unique name for this target. |
*binaries | list of labels | List of *_binary targets to test. |
overlapping_group_behavior | string | How to handle overlapping groups (the same file being present in more than one group). Default: "warn" |
expected_group_names | list of strings | If set, the test verifies that the ordered group names (after optional merging and rank-based ordering) Default: [] |
max_groups | integer | If >= 0, apply lib.merge_to_limit with this limit before ordering. -1 means no limit. Default: -1 |
expected_group_count | integer | If >= 0, verify the exact number of groups after merging (requires max_groups >= 0). Default: -1 |