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_licenses_info_common does not traverse inputs via label_keyed_dict(s) #70

Open
carpenterjc opened this issue Jan 24, 2023 · 0 comments
Labels
bug Something isn't working P2

Comments

@carpenterjc
Copy link

Expected Behavior

Should traverse the dependencies, and pickup all licenses

Actual Behavior

The dict is not which are not list and is converted to a list of a dict so the labels are not traversed. Instead the keys from the dict should be traversed.

Steps to Reproduce the Problem

  1. Define a rule which takes a attr.label_keyed_string_dict
  2. Add a label as an input to that rule which has a license
  3. Check that gather licenses using the rule defined above

Specifications

diff --git a/C:/dev/rules_license-0.0.4/rules/licenses_core.bzl b/rules_license/rules/licenses_core.bzl
index 42702bdb7d..fae491539e 100644
--- a/C:/dev/rules_license-0.0.4/rules/licenses_core.bzl
+++ b/rules_license/rules/licenses_core.bzl
@@ -74,7 +74,9 @@ def _get_transitive_licenses(ctx, trans_licenses, trans_deps, traces, provider,
         a = getattr(ctx.rule.attr, name)
 
         # Make anything singleton into a list for convenience.
-        if type(a) != type([]):
+        if type(a) == type({}):
+            a = a.keys()
+        elif type(a) != type([]):
             a = [a]
         for dep in a:
             # Ignore anything that isn't a target
  • Version: 0.0.4
  • Platform: all
@aiuto aiuto added bug Something isn't working P2 labels Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2
Projects
None yet
Development

No branches or pull requests

2 participants