xref: /aosp_15_r20/external/bazelbuild-rules_license/distro/BUILD (revision f578df4fd057ffe2023728444759535685631548)
1# Copyright 2022 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("//:version.bzl", "version")
16load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")
17load("@rules_pkg//pkg/releasing:defs.bzl", "print_rel_notes")
18
19package(
20    default_visibility = ["//visibility:public"],
21    default_applicable_licenses = ["//:license"],
22)
23
24licenses(["notice"])
25
26alias(
27    name = "distro",
28    actual = "rules_license-%s" % version,
29)
30
31# Build the artifact to put on the github release page.
32pkg_tar(
33    name = "rules_license-%s" % version,
34    srcs = [
35        ":small_workspace",
36        "//:standard_package",
37        "//licenses/generic:standard_package",
38        "//licenses/spdx:standard_package",
39        "//rules:standard_package",
40        "//rules/private:standard_package",
41        "//tools:standard_package",
42    ],
43    extension = "tar.gz",
44    # It is all source code, so make it read-only.
45    mode = "0444",
46    # Make it owned by root so it does not have the uid of the CI robot.
47    owner = "0.0",
48    package_dir = ".",
49    strip_prefix = ".",
50    tags = [
51        "no_windows",
52    ],
53)
54
55genrule(
56    name = "small_workspace",
57    srcs = ["//:WORKSPACE"],
58    outs = ["WORKSPACE"],
59    cmd = "sed -e '/### INTERNAL ONLY/,$$d' $(location //:WORKSPACE) >$@",
60    tags = [
61        "no_windows",
62    ],
63)
64
65print_rel_notes(
66    name = "relnotes",
67    outs = ["relnotes.txt"],
68    mirror_host = "mirror.bazel.build",
69    org = "bazelbuild",
70    repo = "rules_license",
71    version = version,
72)
73