Rules for declaring the compliance licenses used by a package.

license


license(<a href="#license-name">name</a>, <a href="#license-copyright_notice">copyright_notice</a>, <a href="#license-license_kinds">license_kinds</a>, <a href="#license-license_text">license_text</a>, <a href="#license-package_name">package_name</a>, <a href="#license-package_url">package_url</a>, <a href="#license-package_version">package_version</a>)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
copyright_noticeCopyright notice.Stringoptional""
license_kindsLicense 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 labelsoptional[]
license_textThe license file.LabeloptionalLICENSE
package_nameA human readable name identifying this package. This may be used to produce an index of OSS packages used by an applicatation.Stringoptional""
package_urlThe URL this instance of the package was download from. This may be used to produce an index of OSS packages used by an applicatation.Stringoptional""
package_versionA 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.Stringoptional""

Proof of concept. License restriction.

license_kind


license_kind(<a href="#license_kind-name">name</a>, <a href="#license_kind-canonical_text">canonical_text</a>, <a href="#license_kind-conditions">conditions</a>, <a href="#license_kind-long_name">long_name</a>, <a href="#license_kind-url">url</a>)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
canonical_textFile containing the canonical text for this license. Must be UTF-8 encoded.LabeloptionalNone
conditionsConditions to be met when using software under this license. Conditions are defined by the organization using this license.List of stringsrequired
long_nameHuman readable long name of license.Stringoptional""
urlURL pointing to canonical license definitionStringoptional""

Rules for declaring metadata about a package.

package_info


package_info(<a href="#package_info-name">name</a>, <a href="#package_info-package_name">package_name</a>, <a href="#package_info-package_url">package_url</a>, <a href="#package_info-package_version">package_version</a>)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
package_nameA human readable name identifying this package. This may be used to produce an index of OSS packages used by an applicatation.Stringoptional""
package_urlThe URL this instance of the package was download from. This may be used to produce an index of OSS packages used by an applicatation.Stringoptional""
package_versionA 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.Stringoptional""

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(<a href="#LicenseInfo-copyright_notice">copyright_notice</a>, <a href="#LicenseInfo-label">label</a>, <a href="#LicenseInfo-license_kinds">license_kinds</a>, <a href="#LicenseInfo-license_text">license_text</a>, <a href="#LicenseInfo-package_name">package_name</a>, <a href="#LicenseInfo-package_url">package_url</a>, <a href="#LicenseInfo-package_version">package_version</a>)

Provides information about a license instance.

FIELDS

NameDescription
copyright_noticestring: Human readable short copyright notice
labelLabel: label of the license rule
license_kindslist(LicenseKindInfo): License kinds
license_textstring: The license file path
package_namestring: Human readable package name
package_urlURL from which this package was downloaded.
package_versionHuman 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(<a href="#LicenseKindInfo-conditions">conditions</a>, <a href="#LicenseKindInfo-label">label</a>, <a href="#LicenseKindInfo-long_name">long_name</a>, <a href="#LicenseKindInfo-name">name</a>)

Provides information about a license_kind instance.

FIELDS

NameDescription
conditionslist(string): List of conditions to be met when using this packages under this license.
labelLabel: The full path to the license kind definition.
long_namestring: Human readable license name
namestring: 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(<a href="#PackageInfo-type">type</a>, <a href="#PackageInfo-label">label</a>, <a href="#PackageInfo-package_name">package_name</a>, <a href="#PackageInfo-package_url">package_url</a>, <a href="#PackageInfo-package_version">package_version</a>)

Provides information about a package.

FIELDS

NameDescription
typestring: How to interpret data
labelLabel: label of the package_info rule
package_namestring: Human readable package name
package_urlstring: URL from which this package was downloaded.
package_versionstring: Human readable version string

Rules and macros for collecting LicenseInfo providers.

gather_metadata_info


gather_metadata_info(<a href="#gather_metadata_info-name">name</a>)

Collects LicenseInfo providers into a single TransitiveMetadataInfo provider.

ASPECT ATTRIBUTES

NameType
*String

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired

Rules and macros for collecting LicenseInfo providers.

gather_metadata_info_and_write


gather_metadata_info_and_write(<a href="#gather_metadata_info_and_write-name">name</a>)

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

NameType
*String

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired

Rules and macros for collecting package metdata providers.

trace


trace(<a href="#trace-name">name</a>)

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

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired