Switch to rules_license Apparently Bazel has deprecated the built-in licenses() command and now expects you to pull in an external package. I think I've gotten this right? Since our new BUILD.bazel file is actually referenced by the old -with-bazel branch, this new dependency also needs to work there. That is still using the legacy WORKSPACE system, but I got that working there too, I think. However, as the legacy WORKSPACE system does not consider recursive dependencies, anyone using it and updating BoringSSL will need to, in turn, update their WORKSPACE file on update. Fixed: 365824757 Change-Id: I7b49f33d628cec2ec07a47f0e31f16765d0f532a Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/71147 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Ben Lawson <benlawson@google.com> Reviewed-by: Adam Langley <agl@google.com>
diff --git a/BUILD.bazel b/BUILD.bazel index 9e7b430..ce4144d 100644 --- a/BUILD.bazel +++ b/BUILD.bazel
@@ -43,14 +43,31 @@ "urandom_test_sources", ) load(":util/util.bzl", "bssl_cc_binary", "bssl_cc_library", "bssl_cc_test") +load("@rules_license//rules:license.bzl", "license") -# Disable the parse_headers feature. It does not work well in C right now. See -# https://github.com/bazelbuild/bazel/issues/23460 for details. When that is -# fixed, if enabled, we likely also need to rename some headers to .inc per -# https://google.github.io/styleguide/cppguide.html#Self_contained_Headers -package(features = ["-parse_headers"]) +package( + default_applicable_licenses = [":license"], + # Disable the parse_headers feature. It does not work well in C right now. + # See https://github.com/bazelbuild/bazel/issues/23460 for details. When + # that is fixed, if enabled, we likely also need to rename some headers to + # .inc per + # https://google.github.io/styleguide/cppguide.html#Self_contained_Headers + features = ["-parse_headers"], +) -licenses(["notice"]) +license( + name = "license", + package_name = "BoringSSL", + # TODO(crbug.com/364634028): Update this once we've aligned with OpenSSL's + # new license. + license_kinds = [ + "@rules_license//licenses/spdx:ISC", + "@rules_license//licenses/spdx:OpenSSL", + "@rules_license//licenses/spdx:MIT", + "@rules_license//licenses/spdx:SSLeay-standalone", + ], + license_text = "LICENSE", +) exports_files(["LICENSE"])
diff --git a/MODULE.bazel b/MODULE.bazel index 34f1651..0447733 100644 --- a/MODULE.bazel +++ b/MODULE.bazel
@@ -34,3 +34,4 @@ bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_license", version = "1.0.0")
diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 47be1de..38fdcfe 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock
@@ -64,7 +64,8 @@ "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", - "https://bcr.bazel.build/modules/rules_license/0.0.7/source.json": "355cc5737a0f294e560d52b1b7a6492d4fff2caf0bef1a315df5a298fca2d34a", + "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c", + "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb", "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06",
diff --git a/util/WORKSPACE.toplevel b/util/WORKSPACE.toplevel index 58f81bb..93f64ee 100644 --- a/util/WORKSPACE.toplevel +++ b/util/WORKSPACE.toplevel
@@ -1 +1,11 @@ workspace(name = "boringssl") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "rules_license", + sha256 = "26d4021f6898e23b82ef953078389dd49ac2b5618ac564ade4ef87cced147b38", + urls = [ + "https://github.com/bazelbuild/rules_license/releases/download/1.0.0/rules_license-1.0.0.tar.gz", + ], +)