Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gather_metadata doesn't transitively handle the label_keyed_string_dict_type #160

Open
quic-sbjorkle opened this issue Oct 2, 2024 · 0 comments

Comments

@quic-sbjorkle
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant