From c142245ca7f5523275990b9eeefff82673ae4f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nenad=20Miks=CC=8Ca?= Date: Sun, 31 Aug 2025 11:09:26 +0200 Subject: [PATCH] use rules_license to set the license Using rules_license makes it easier to generate SBOMs than with old built-in licenses function. --- BUILD.bazel | 16 ++++++++++++++-- MODULE.bazel | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 2c6375fd..624554ce 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,12 +1,24 @@ # Copied from TensorFlow's `tensorflow/tree/master/third_party/cpuinfo/BUILD # Licenced under Apache-2.0 License +load("@rules_license//rules:license.bzl", "license") # cpuinfo, a library to detect information about the host CPU -package(default_visibility = ["//visibility:public"]) +package( + default_applicable_licenses = [":license"], + default_visibility = ["//visibility:public"] +) licenses(["notice"]) -exports_files(["LICENSE"]) +exports_files([ + "LICENSE", +]) + +license( + name = "license", + license_kinds = ["@rules_license//licenses/spdx:BSD-2-Clause"], + license_text = "LICENSE", +) C99OPTS = [ "-std=gnu99", # gnu99, not c99, because dprintf is used diff --git a/MODULE.bazel b/MODULE.bazel index 961ad95a..a523be65 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1 +1,3 @@ module(name = "cpuinfo") + +bazel_dep(name = "rules_license", version = "1.0.0")