Skip to the content.

Rules for declaring the compliance licenses used by a package.

license

license(name, copyright_notice, license_kinds, license_text, package_name, package_url,
         package_version)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required  
copyright_notice Copyright notice. String optional ""
license_kinds License kind(s) of this license. If multiple license kinds are listed in the LICENSE file, and they all apply, then all should be listed here. If the user can choose a single one of many, then only list one here. List of labels optional []
license_text The license file. Label optional LICENSE
package_name A human readable name identifying this package. This may be used to produce an index of OSS packages used by an applicatation. String optional ""
package_url The URL this instance of the package was download from. This may be used to produce an index of OSS packages used by an applicatation. String optional ""
package_version A human readable version string identifying this package. This may be used to produce an index of OSS packages used by an applicatation. It should be a value that increases over time, rather than a commit hash. String optional ""

Proof of concept. License restriction.

license_kind

license_kind(name, canonical_text, conditions, long_name, url)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required  
canonical_text File containing the canonical text for this license. Must be UTF-8 encoded. Label optional None
conditions Conditions to be met when using software under this license. Conditions are defined by the organization using this license. List of strings required  
long_name Human readable long name of license. String optional ""
url URL pointing to canonical license definition String optional ""

Rules for declaring metadata about a package.

package_info

package_info(name, package_name, package_url, package_version)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required  
package_name A human readable name identifying this package. This may be used to produce an index of OSS packages used by an applicatation. String optional ""
package_url The URL this instance of the package was download from. This may be used to produce an index of OSS packages used by an applicatation. String optional ""
package_version A human readable version string identifying this package. This may be used to produce an index of OSS packages used by an applicatation. It should be a value that increases over time, rather than a commit hash. String optional ""

Basic providers for license rules.

This file should only contain the basic providers needed to create license and package_info declarations. Providers needed to gather them are declared in other places.

LicenseInfo

LicenseInfo(copyright_notice, label, license_kinds, license_text, package_name, package_url,
            package_version)

Provides information about a license instance.

FIELDS

Name Description
copyright_notice string: Human readable short copyright notice
label Label: label of the license rule
license_kinds list(LicenseKindInfo): License kinds
license_text string: The license file path
package_name string: Human readable package name
package_url URL from which this package was downloaded.
package_version Human readable version string

Basic providers for license rules.

This file should only contain the basic providers needed to create license and package_info declarations. Providers needed to gather them are declared in other places.

LicenseKindInfo

LicenseKindInfo(conditions, label, long_name, name)

Provides information about a license_kind instance.

FIELDS

Name Description
conditions list(string): List of conditions to be met when using this packages under this license.
label Label: The full path to the license kind definition.
long_name string: Human readable license name
name string: Canonical license name

Basic providers for license rules.

This file should only contain the basic providers needed to create license and package_info declarations. Providers needed to gather them are declared in other places.

PackageInfo

PackageInfo(type, label, package_name, package_url, package_version)

Provides information about a package.

FIELDS

Name Description
type string: How to interpret data
label Label: label of the package_info rule
package_name string: Human readable package name
package_url string: URL from which this package was downloaded.
package_version string: Human readable version string

Rules and macros for collecting LicenseInfo providers.

gather_metadata_info

gather_metadata_info(name)

Collects LicenseInfo providers into a single TransitiveMetadataInfo provider.

ASPECT ATTRIBUTES

Name Type
* String

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required  

Rules and macros for collecting LicenseInfo providers.

gather_metadata_info_and_write

gather_metadata_info_and_write(name)

Collects TransitiveMetadataInfo providers and writes JSON representation to a file.

Usage:
  bazel build //some:target           --aspects=@rules_license//rules_gathering:gather_metadata.bzl%gather_metadata_info_and_write
      --output_groups=licenses

ASPECT ATTRIBUTES

Name Type
* String

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required  

Rules and macros for collecting package metdata providers.

trace

trace(name)

Used to allow the specification of a target to trace while collecting license dependencies.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required