Skip to content

Update license_policy_check to support multi-file producing targets#71

Closed
danielmachlab wants to merge 8 commits intobazelbuild:mainfrom
danielmachlab:policy_check
Closed

Update license_policy_check to support multi-file producing targets#71
danielmachlab wants to merge 8 commits intobazelbuild:mainfrom
danielmachlab:policy_check

Conversation

@danielmachlab
Copy link
Copy Markdown
Collaborator

When license_policy_check is applied to a target that generates multiple files, the policy check fails. See below for an example error message.

in target attribute of _license_policy_check rule <:label_for_target_policy_check_is_applied_to> must produce a single file.

This seems to be due to allow_single_file = True in the description of the rule's attr target. This change removes the line, allowing a policy check to be applied to targets producing multiple files or a single file.

This change was tested by applying license_policy_check to a java_binary target (producing 2 files) and a java_library target (producing 1 file). Both policy checks ran successfully.

@danielmachlab danielmachlab requested a review from aiuto as a code owner January 30, 2023 19:53
Copy link
Copy Markdown
Collaborator

@aiuto aiuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I fixed the merge conflict.

@aiuto
Copy link
Copy Markdown
Collaborator

aiuto commented May 22, 2023

I think this needs a BUILD file change too.

@aiuto
Copy link
Copy Markdown
Collaborator

aiuto commented Jun 5, 2023

This needs a change to the test case.



(18:56:13) ERROR: package contains errors: examples/policy_checker: Traceback (most recent call last):
--
  | File "C:/b/bk-windows-308l/bazel/rules-license/examples/policy_checker/BUILD", line 47, column 21, in <toplevel>
  | license_policy_check(
  | File "C:/b/bk-windows-308l/bazel/rules-license/examples/policy_checker/license_policy_check.bzl", line 74, column 5, in license_policy_check
  | def license_policy_check(name, targets, policy, **kwargs):
  | Error: license_policy_check() missing 1 required positional argument: targets

target => targets in examples/policy_checker/BUILD

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

Successfully merging this pull request may close these issues.

2 participants