conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8k stars 953 forks source link

[feature] Add license and package_info to bazel generator #16629

Open peakschris opened 1 week ago

peakschris commented 1 week ago

What is your suggestion?

Bazel's sbom generator (rules_license) requires that package build files contain a number of declarations to teach bazel about name, package url, license, etc. Could conan's bazel generator include this information in the build files that it generates?

Here is an example for the poco build file:

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"]
)

license(
    name = "license",
    license_kinds = [
        "@rules_license//licenses/spdx:BSL-1.0",
    ],
    # reference to the license filename inside the conan artifact
    license_text = ["LICENSE"],
)

package_info(
    name = "package_info",
    package_name = "poco",
    package_url = None,
    package_version = "{version}",
    purl = "pkg:conan/pocoproject/poco@{version}",
)

If we can agree on an approach, I could possibly contribute a PR

Have you read the CONTRIBUTING guide?

peakschris commented 1 week ago

@aiuto fyi

franramirez688 commented 1 week ago

Hi @peakschris

Thanks for suggesting this! I have no objection to adding this. Would you want to contribute with a PR? I can help with that for sure 😁