From e1df5cdf7ad96db86f7a28d02d669faf7ef95359 Mon Sep 17 00:00:00 2001 From: Googler Date: Mon, 6 Nov 2023 07:21:11 -0800 Subject: [PATCH] Migration of `applicable_licenses` to `package_metadata`. Data gathering aspects will look for either version of the name. After a Bazel release or two we can delete the lookup on `applicable_license` RELNOTES: None PiperOrigin-RevId: 579835543 Change-Id: I9b962dd41d4c318081ac2a891d2ec53892d48e3e --- tools/compliance/gather_packages.bzl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/compliance/gather_packages.bzl b/tools/compliance/gather_packages.bzl index 1adb970b78fb3d..dacb663ddd9a96 100644 --- a/tools/compliance/gather_packages.bzl +++ b/tools/compliance/gather_packages.bzl @@ -150,6 +150,12 @@ def gather_package_common(target, ctx, provider_factory, metadata_providers, fil licenses.append(dep[LicenseInfo]) if PackageInfo in dep: package_info.depend(dep[LicenseInfo]) + elif hasattr(ctx.rule.attr, "package_metadata"): + for dep in ctx.rule.attr.package_metadata: + if LicenseInfo in dep: + licenses.append(dep[LicenseInfo]) + if PackageInfo in dep: + package_info.depend(dep[LicenseInfo]) # Record all the external repos anyway. target_name = str(target.label)