rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Provide rules_license metadata in crate BUILD files

Open nickcollier opened this issue 1 year ago • 1 comments

Please provide an option to include rules_license metadata when rendering crate BUILD files.

For example the BUILD file for the rand crate would include

...

load("@rules_license//rules:package_info.bzl", "package_info")

load("@rules_license//rules:license.bzl", "license")

package(
    default_package_metadata = [
        ":license",
        ":package_info",
    ],
    default_visibility = ["//visibility:public"],
)

package_info(
    name = "package_info",
    package_name = "rand",
    package_version = "0.8.5",
    package_url = "https://github.com/rust-random/rand",
)

license(
    name = "license",
    license_kinds = [
        "@rules_license//licenses/spdx:Apache-2.0",
        "@rules_license//licenses/spdx:MIT",
    ],
)

...

nickcollier avatar Feb 12 '24 09:02 nickcollier

rules_license also gives the option to set copyright_notice and license_text. Should there be an option to try and get this automatically as well? Or is this too complicated and should be done if needed via the package_url field by users?

fhilgers avatar Jun 04 '24 17:06 fhilgers