From f4f0e1322ec6e0e7a15675273ee51583fe1bd837 Mon Sep 17 00:00:00 2001 From: Tony Aiuto Date: Fri, 24 Oct 2025 16:55:49 -0400 Subject: [PATCH] Write the kind of the license attribute into the json blob. Partly addesses https://github.com/bazel-contrib/supply-chain/issues/95 --- metadata/licenses/rules/license.bzl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/metadata/licenses/rules/license.bzl b/metadata/licenses/rules/license.bzl index 91bf506..5a5b71f 100644 --- a/metadata/licenses/rules/license.bzl +++ b/metadata/licenses/rules/license.bzl @@ -5,12 +5,18 @@ load("//providers:package_attribute_info.bzl", "PackageAttributeInfo") visibility("public") +_KIND = "bazel-contrib.supply-chain.license" + def _license_impl(ctx): - kind = ctx.attr.kind[LicenseKindInfo] + # We need to pull up the kind information from the child because aspect + # traversal will not hit the dependents of targets brought in via + # pacakge_metadata. + license_kind = ctx.attr.kind[LicenseKindInfo] attribute = { - "kind": { - "identifier": kind.identifier, - "name": kind.name, + "kind": _KIND, + "license_kind": { + "identifier": license_kind.identifier, + "name": license_kind.name, }, "label": str(ctx.label), } @@ -35,7 +41,7 @@ def _license_impl(ctx): ), ), PackageAttributeInfo( - kind = "build.bazel.attribute.license", + kind = _KIND, attributes = output, files = files, ),