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

Explore ways to have more package metadata providers. #59

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions rules/licenses_core.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ def gather_metadata_info_common(target, ctx, provider_factory, namespaces, metad
for m_p in metadata_providers:
if m_p in dep:
other_metadata.append(dep[m_p])
# Remove: Only here to show fanout from explict providers.
# if PackageInfo in dep:
# package_info.append(dep[PackageInfo])

# Now gather transitive collection of providers from the targets
# this target depends upon.
Expand Down
25 changes: 23 additions & 2 deletions rules/private/gathering_providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ LicensedTargetInfo = provider(
},
)

def licenses_info():
def XXX_licenses_info():
return provider(
doc = """The transitive set of licenses used by a target.""",
fields = {
Expand All @@ -37,7 +37,28 @@ def licenses_info():
)

# This provider is used by the aspect that is used by manifest() rules.
TransitiveLicensesInfo = licenses_info()
# XXXX TransitiveLicensesInfo = licenses_info()

# Constructor to reduce larger set of gathered data to what we want.
def TransitiveLicensesInfoInit(target_under_license=None, licenses=None, deps=None, traces=None, **kwargs):
return {
"target_under_license": target_under_license,
"deps": deps,
"licenses": licenses,
"traces": traces,
}


TransitiveLicensesInfo, _raw_TransitiveLicensesInfo = provider(
doc = """The transitive set of licenses used by a target.""",
fields = {
"target_under_license": "Label: The top level target label.",
"deps": "depset(LicensedTargetInfo): The transitive list of dependencies that have licenses.",
"licenses": "depset(LicenseInfo)",
"traces": "list(string) - diagnostic for tracing a dependency relationship to a target.",
},
init = TransitiveLicensesInfoInit,
)

TransitiveMetadataInfo = provider(
doc = """The transitive set of licenses used by a target.""",
Expand Down