Skip to content

gather_metadata doesn't transitively handle the label_keyed_string_dict_type #160

Open
@quic-sbjorkle

Description

@quic-sbjorkle

Expected Behavior

When generating a transitive metadata list using the @rules_license//rules_gathering:gather_metadata.bzl%gather_metadata_info_and_write aspect we expect all metadata for the complete dependency tree to be collected.

Actual Behavior

Dependency tree is cut when reaching an attribute with the label_keyed_string_dict_type.

Steps to Reproduce the Problem

  1. Declare a rule with an attribute with type label_keyed_string_dict_type
  2. Instantiate the rule and add dependencies to a licensed target on the dict -> string format
  3. Execute the aspect and notice how the license information is lost in the aggregation

Proposed solution

Extend label_keyed_string_dict_type in licenses_core.bzl to also expand the dict keys.

Example:

        dict_deps = []
        for dep in a:
            if type(dep) == 'dict':
                for d in dep.keys():
                    if type(d) != 'list':
                        dict_deps.append(d)
                    else:
                        dict_deps.extend(d)
        for dep in a + dict_deps:
            # Ignore anything that isn't a target
            if type(dep) != "Target":
                continue

Specifications

  • Version: 1.0.0
  • Platform: linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions